mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
update schema to store location on accompanying period
This commit is contained in:
parent
979ea5841d
commit
34f22d237e
@ -25,6 +25,7 @@ namespace Chill\PersonBundle\Entity;
|
|||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
|
use Chill\MainBundle\Entity\Address;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||||
@ -291,6 +292,22 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
*/
|
*/
|
||||||
private Collection $works;
|
private Collection $works;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(
|
||||||
|
* targetEntity=Person::class,
|
||||||
|
* inversedBy="periodLocatedOn"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
private ?Person $personLocation = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(
|
||||||
|
* targetEntity=Address::class
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
private ?Address $addressLocation = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccompanyingPeriod constructor.
|
* AccompanyingPeriod constructor.
|
||||||
*
|
*
|
||||||
|
@ -30,6 +30,7 @@ use Chill\MainBundle\Entity\Country;
|
|||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
use Chill\PersonBundle\Entity\MaritalStatus;
|
use Chill\PersonBundle\Entity\MaritalStatus;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
@ -379,6 +380,19 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
*/
|
*/
|
||||||
private Collection $householdAddresses;
|
private Collection $householdAddresses;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(
|
||||||
|
* targetEntity=AccompanyingPeriod::class,
|
||||||
|
* mappedBy="personLocation"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
private Collection $periodLocatedOn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Person constructor.
|
||||||
|
*
|
||||||
|
* @param \DateTime|null $opening
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->accompanyingPeriodParticipations = new ArrayCollection();
|
$this->accompanyingPeriodParticipations = new ArrayCollection();
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add location to accompanying period
|
||||||
|
*/
|
||||||
|
final class Version20210727152826 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add location to accompanying period';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD personLocation_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD addressLocation_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A868D5213D34 FOREIGN KEY (personLocation_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A8689B07D6BF FOREIGN KEY (addressLocation_id) REFERENCES chill_main_address (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_E260A868D5213D34 ON chill_person_accompanying_period (personLocation_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_E260A8689B07D6BF ON chill_person_accompanying_period (addressLocation_id)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A868D5213D34');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A8689B07D6BF');
|
||||||
|
$this->addSql('DROP INDEX IDX_E260A868D5213D34');
|
||||||
|
$this->addSql('DROP INDEX IDX_E260A8689B07D6BF');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP personLocation_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP addressLocation_id');
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user