From 175fa7bf2ffd77bbd6e7df9a534b0f55399083bf Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 19 Jan 2022 11:09:02 +0100 Subject: [PATCH] php code fix --- .../Entity/AccompanyingPeriod.php | 41 +++++++++---------- .../migrations/Version20220119091025.php | 16 ++++---- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 13a597efc..3d7d1a7b4 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -113,15 +113,6 @@ class AccompanyingPeriod implements */ public const STEP_DRAFT = 'DRAFT'; - - /** - * @ORM\ManyToOne( - * targetEntity=UserJob::class - * ) - * @Groups({"read", "write"}) - */ - private ?UserJob $job = null; - /** * @ORM\ManyToOne( * targetEntity=Address::class @@ -208,6 +199,14 @@ class AccompanyingPeriod implements */ private $intensity = self::INTENSITY_OCCASIONAL; + /** + * @ORM\ManyToOne( + * targetEntity=UserJob::class + * ) + * @Groups({"read", "write"}) + */ + private ?UserJob $job = null; + /** * @var DateTime * @@ -404,18 +403,6 @@ class AccompanyingPeriod implements 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 { $this->comments[] = $comment; @@ -647,6 +634,11 @@ class AccompanyingPeriod implements return $this->intensity; } + public function getJob(): ?UserJob + { + return $this->job; + } + /** * Get the location, taking precedence into account. * @@ -1080,6 +1072,13 @@ class AccompanyingPeriod implements return $this; } + public function setJob(?UserJob $job): self + { + $this->job = $job; + + return $this; + } + /** * Set openingDate. * diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220119091025.php b/src/Bundle/ChillPersonBundle/migrations/Version20220119091025.php index a8f125fdf..c047b3dca 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20220119091025.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220119091025.php @@ -15,10 +15,17 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; /** - * Add userJob to AccompanyingPeriod + * Add userJob to AccompanyingPeriod. */ 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 { 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('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'); - } }