mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
accompanyingPeriod: add job
This commit is contained in:
parent
2ff34688bb
commit
3471bdec0d
@ -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;
|
||||
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add userJob to AccompanyingPeriod
|
||||
*/
|
||||
final class Version20220119091025 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add userJob to AccompanyingPeriod';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->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');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user