php code fix

This commit is contained in:
nobohan 2022-01-19 11:09:02 +01:00
parent 9f7f6e33e8
commit 175fa7bf2f
2 changed files with 28 additions and 29 deletions

View File

@ -113,15 +113,6 @@ class AccompanyingPeriod implements
*/ */
public const STEP_DRAFT = 'DRAFT'; public const STEP_DRAFT = 'DRAFT';
/**
* @ORM\ManyToOne(
* targetEntity=UserJob::class
* )
* @Groups({"read", "write"})
*/
private ?UserJob $job = null;
/** /**
* @ORM\ManyToOne( * @ORM\ManyToOne(
* targetEntity=Address::class * targetEntity=Address::class
@ -208,6 +199,14 @@ class AccompanyingPeriod implements
*/ */
private $intensity = self::INTENSITY_OCCASIONAL; private $intensity = self::INTENSITY_OCCASIONAL;
/**
* @ORM\ManyToOne(
* targetEntity=UserJob::class
* )
* @Groups({"read", "write"})
*/
private ?UserJob $job = null;
/** /**
* @var DateTime * @var DateTime
* *
@ -404,18 +403,6 @@ class AccompanyingPeriod implements
return $array; return $array;
} }
public function getJob(): ?UserJob
{
return $this->job;
}
public function setJob(?UserJob $job): self
{
$this->job = $job;
return $this;
}
public function addComment(Comment $comment): self public function addComment(Comment $comment): self
{ {
$this->comments[] = $comment; $this->comments[] = $comment;
@ -647,6 +634,11 @@ class AccompanyingPeriod implements
return $this->intensity; return $this->intensity;
} }
public function getJob(): ?UserJob
{
return $this->job;
}
/** /**
* Get the location, taking precedence into account. * Get the location, taking precedence into account.
* *
@ -1080,6 +1072,13 @@ class AccompanyingPeriod implements
return $this; return $this;
} }
public function setJob(?UserJob $job): self
{
$this->job = $job;
return $this;
}
/** /**
* Set openingDate. * Set openingDate.
* *

View File

@ -15,10 +15,17 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
/** /**
* Add userJob to AccompanyingPeriod * Add userJob to AccompanyingPeriod.
*/ */
final class Version20220119091025 extends AbstractMigration final class Version20220119091025 extends AbstractMigration
{ {
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A868BE04EA9');
$this->addSql('DROP INDEX IDX_E260A868BE04EA9');
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP job_id');
}
public function getDescription(): string public function getDescription(): string
{ {
return 'Add userJob to AccompanyingPeriod'; return 'Add userJob to AccompanyingPeriod';
@ -30,11 +37,4 @@ final class Version20220119091025 extends AbstractMigration
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A868BE04EA9 FOREIGN KEY (job_id) REFERENCES chill_main_user_job (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A868BE04EA9 FOREIGN KEY (job_id) REFERENCES chill_main_user_job (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_E260A868BE04EA9 ON chill_person_accompanying_period (job_id)'); $this->addSql('CREATE INDEX IDX_E260A868BE04EA9 ON chill_person_accompanying_period (job_id)');
} }
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A868BE04EA9');
$this->addSql('DROP INDEX IDX_E260A868BE04EA9');
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP job_id');
}
} }