diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 06e4f0c8b..13a597efc 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Entity\HasScopesInterface; use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Entity\UserJob; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive; use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment; @@ -112,6 +113,15 @@ 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 @@ -394,6 +404,18 @@ 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; diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220119091025.php b/src/Bundle/ChillPersonBundle/migrations/Version20220119091025.php new file mode 100644 index 000000000..a8f125fdf --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220119091025.php @@ -0,0 +1,40 @@ +addSql('ALTER TABLE chill_person_accompanying_period ADD job_id INT DEFAULT NULL'); + $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'); + } +}