mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'fix_load_fixtures' into 'master'
Fix load fixtures See merge request Chill-Projet/chill-bundles!66
This commit is contained in:
commit
9b66f7a83f
@ -137,7 +137,7 @@ class Address
|
|||||||
* @var ThirdParty|null
|
* @var ThirdParty|null
|
||||||
*
|
*
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||||
* @ORM\JoinColumn(nullable=true)
|
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
|
||||||
*/
|
*/
|
||||||
private $linkedToThirdParty;
|
private $linkedToThirdParty;
|
||||||
|
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Main;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify ON DELETE behaviour to handle deletion of parents in associated tables
|
||||||
|
*/
|
||||||
|
final class Version20210525144016 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Specify ON DELETE behaviour to handle deletion of parents in associated tables';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_main_address DROP CONSTRAINT FK_165051F6114B8DD9');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_address ADD CONSTRAINT FK_165051F6114B8DD9 FOREIGN KEY (linkedToThirdParty_id) REFERENCES chill_3party.third_party (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_main_address DROP CONSTRAINT fk_165051f6114b8dd9');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_address ADD CONSTRAINT fk_165051f6114b8dd9 FOREIGN KEY (linkedtothirdparty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
}
|
@ -51,7 +51,7 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @ORM\ManyToOne(
|
* @ORM\ManyToOne(
|
||||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod",
|
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod",
|
||||||
* inversedBy="comments")
|
* inversedBy="comments")
|
||||||
* @ORM\JoinColumn(nullable=false)
|
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
|
||||||
*/
|
*/
|
||||||
private $accompanyingPeriod;
|
private $accompanyingPeriod;
|
||||||
|
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify ON DELETE behaviour to handle deletion of parents in associated tables
|
||||||
|
*/
|
||||||
|
final class Version20210525211214 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Specify ON DELETE behaviour to handle deletion of parents in associated tables';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment DROP CONSTRAINT FK_CD960EF3D7FA8EF0');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT FK_CD960EF3D7FA8EF0 FOREIGN KEY (accompanyingPeriod_id) REFERENCES chill_person_accompanying_period (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment DROP CONSTRAINT fk_cd960ef3d7fa8ef0');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT fk_cd960ef3d7fa8ef0 FOREIGN KEY (accompanyingperiod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
}
|
@ -32,9 +32,9 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ThirdParty is a party recorded in the database.
|
* ThirdParty is a party recorded in the database.
|
||||||
*
|
*
|
||||||
* A party may be attached to multiple centers. Being attach to a center allow
|
* A party may be attached to multiple centers. Being attach to a center allow
|
||||||
* all users with the right 'CHILL_3PARTY_3PARTY_SEE', 'CHILL_3PARTY_3 to see, select and edit parties for this
|
* all users with the right 'CHILL_3PARTY_3PARTY_SEE', 'CHILL_3PARTY_3 to see, select and edit parties for this
|
||||||
* center.
|
* center.
|
||||||
*
|
*
|
||||||
* @ORM\Table(name="chill_3party.third_party")
|
* @ORM\Table(name="chill_3party.third_party")
|
||||||
@ -66,7 +66,7 @@ class ThirdParty
|
|||||||
* @var string|null
|
* @var string|null
|
||||||
*
|
*
|
||||||
* @ORM\Column(name="telephone", type="string", length=64, nullable=true)
|
* @ORM\Column(name="telephone", type="string", length=64, nullable=true)
|
||||||
* @Assert\Regex("/^([\+{1}])([0-9\s*]{4,20})$/",
|
* @Assert\Regex("/^([\+{1}])([0-9\s*]{4,20})$/",
|
||||||
* message="Invalid phone number: it should begin with the international prefix starting with ""+"", hold only digits and be smaller than 20 characters. Ex: +33123456789"
|
* message="Invalid phone number: it should begin with the international prefix starting with ""+"", hold only digits and be smaller than 20 characters. Ex: +33123456789"
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@ -94,13 +94,13 @@ class ThirdParty
|
|||||||
* @Assert\Count(min=1)
|
* @Assert\Count(min=1)
|
||||||
*/
|
*/
|
||||||
private $type;
|
private $type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var boolean
|
||||||
* @ORM\Column(name="active", type="boolean", options={"defaut": true})
|
* @ORM\Column(name="active", type="boolean", options={"defaut": true})
|
||||||
*/
|
*/
|
||||||
private $active = true;
|
private $active = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection instances of Center
|
* @var Collection instances of Center
|
||||||
* @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center")
|
* @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center")
|
||||||
@ -108,14 +108,15 @@ class ThirdParty
|
|||||||
* @Assert\Count(min=1)
|
* @Assert\Count(min=1)
|
||||||
*/
|
*/
|
||||||
private $centers;
|
private $centers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Address|null
|
* @var Address|null
|
||||||
* @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address",
|
* @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address",
|
||||||
* cascade={"persist", "remove"})
|
* cascade={"persist", "remove"})
|
||||||
|
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
|
||||||
*/
|
*/
|
||||||
private $address;
|
private $address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ThirdParty constructor.
|
* ThirdParty constructor.
|
||||||
*/
|
*/
|
||||||
@ -249,7 +250,7 @@ class ThirdParty
|
|||||||
{
|
{
|
||||||
return $this->type;
|
return $this->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@ -257,7 +258,7 @@ class ThirdParty
|
|||||||
{
|
{
|
||||||
return $this->active;
|
return $this->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
@ -265,7 +266,7 @@ class ThirdParty
|
|||||||
{
|
{
|
||||||
return $this->centers;
|
return $this->centers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $active
|
* @param bool $active
|
||||||
* @return $this
|
* @return $this
|
||||||
@ -275,7 +276,7 @@ class ThirdParty
|
|||||||
$this->active = $active;
|
$this->active = $active;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Center $center
|
* @param Center $center
|
||||||
*/
|
*/
|
||||||
@ -285,7 +286,7 @@ class ThirdParty
|
|||||||
$this->centers->add($center);
|
$this->centers->add($center);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Center $center
|
* @param Center $center
|
||||||
*/
|
*/
|
||||||
@ -295,7 +296,7 @@ class ThirdParty
|
|||||||
$this->centers->removeElement($center);
|
$this->centers->removeElement($center);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $centers
|
* @param Collection $centers
|
||||||
* @return $this
|
* @return $this
|
||||||
@ -305,16 +306,16 @@ class ThirdParty
|
|||||||
foreach ($centers as $center) {
|
foreach ($centers as $center) {
|
||||||
$this->addCenter($center);
|
$this->addCenter($center);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->centers as $center) {
|
foreach ($this->centers as $center) {
|
||||||
if (FALSE === $centers->contains($center)) {
|
if (FALSE === $centers->contains($center)) {
|
||||||
$this->removeCenter($center);
|
$this->removeCenter($center);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Address|null
|
* @return Address|null
|
||||||
*/
|
*/
|
||||||
@ -322,7 +323,7 @@ class ThirdParty
|
|||||||
{
|
{
|
||||||
return $this->address;
|
return $this->address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Address $address
|
* @param Address $address
|
||||||
* @return $this
|
* @return $this
|
||||||
@ -330,10 +331,10 @@ class ThirdParty
|
|||||||
public function setAddress(Address $address)
|
public function setAddress(Address $address)
|
||||||
{
|
{
|
||||||
$this->address = $address;
|
$this->address = $address;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\ThirdParty;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify ON DELETE behaviour to handle deletion of parents in associated tables
|
||||||
|
*/
|
||||||
|
final class Version20210525211216 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Specify ON DELETE behaviour to handle deletion of parents in associated tables';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467BF5B7AF75');
|
||||||
|
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467BF5B7AF75 FOREIGN KEY (address_id) REFERENCES chill_main_address (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT fk_d952467bf5b7af75');
|
||||||
|
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT fk_d952467bf5b7af75 FOREIGN KEY (address_id) REFERENCES chill_main_address (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user