<?php | |||||
declare(strict_types=1); | |||||
namespace DoctrineMigrations; | |||||
use Doctrine\DBAL\Schema\Schema; | |||||
use Doctrine\Migrations\AbstractMigration; | |||||
/** | |||||
* Auto-generated Migration: Please modify to your needs! | |||||
*/ | |||||
final class Version20210609090212 extends AbstractMigration | |||||
{ | |||||
public function getDescription(): string | |||||
{ | |||||
return ''; | |||||
} | |||||
public function up(Schema $schema): void | |||||
{ | |||||
// this up() migration is auto-generated, please modify it to your needs | |||||
$this->addSql('ALTER TABLE individual_data ADD territory_id INT DEFAULT NULL'); | |||||
$this->addSql('ALTER TABLE individual_data ADD CONSTRAINT FK_653169D073F74AD4 FOREIGN KEY (territory_id) REFERENCES territory (id)'); | |||||
$this->addSql('CREATE INDEX IDX_653169D073F74AD4 ON individual_data (territory_id)'); | |||||
$this->addSql('ALTER TABLE territory DROP FOREIGN KEY FK_E9743966E2920B1'); | |||||
$this->addSql('DROP INDEX IDX_E9743966E2920B1 ON territory'); | |||||
$this->addSql('ALTER TABLE territory DROP individual_data_id'); | |||||
} | |||||
public function down(Schema $schema): void | |||||
{ | |||||
// this down() migration is auto-generated, please modify it to your needs | |||||
$this->addSql('ALTER TABLE individual_data DROP FOREIGN KEY FK_653169D073F74AD4'); | |||||
$this->addSql('DROP INDEX IDX_653169D073F74AD4 ON individual_data'); | |||||
$this->addSql('ALTER TABLE individual_data DROP territory_id'); | |||||
$this->addSql('ALTER TABLE territory ADD individual_data_id INT DEFAULT NULL'); | |||||
$this->addSql('ALTER TABLE territory ADD CONSTRAINT FK_E9743966E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('CREATE INDEX IDX_E9743966E2920B1 ON territory (individual_data_id)'); | |||||
} | |||||
} |
private $projectsInspiring; | private $projectsInspiring; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=Territory::class, mappedBy="individualData") | |||||
* @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="individualData") | |||||
*/ | */ | ||||
private $territory; | private $territory; | ||||
$this->dreams = new ArrayCollection(); | $this->dreams = new ArrayCollection(); | ||||
$this->projectsBoost = new ArrayCollection(); | $this->projectsBoost = new ArrayCollection(); | ||||
$this->projectsInspiring = new ArrayCollection(); | $this->projectsInspiring = new ArrayCollection(); | ||||
$this->territory = new ArrayCollection(); | |||||
} | } | ||||
public function __toString() | public function __toString() | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|Territory[] | |||||
*/ | |||||
public function getTerritory(): Collection | |||||
public function getTerritory(): ?Territory | |||||
{ | { | ||||
return $this->territory; | return $this->territory; | ||||
} | } | ||||
public function addTerritory(Territory $territory): self | |||||
public function setTerritory(?Territory $territory): self | |||||
{ | { | ||||
if (!$this->territory->contains($territory)) { | |||||
$this->territory[] = $territory; | |||||
$territory->setIndividualData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeTerritory(Territory $territory): self | |||||
{ | |||||
if ($this->territory->removeElement($territory)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($territory->getIndividualData() === $this) { | |||||
$territory->setIndividualData(null); | |||||
} | |||||
} | |||||
$this->territory = $territory; | |||||
return $this; | return $this; | ||||
} | } |
private $name; | private $name; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="territory") | |||||
* @ORM\OneToMany(targetEntity=IndividualData::class, mappedBy="territory") | |||||
*/ | */ | ||||
private $individualData; | private $individualData; | ||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->collectifData = new ArrayCollection(); | $this->collectifData = new ArrayCollection(); | ||||
$this->individualData = new ArrayCollection(); | |||||
} | } | ||||
public function __toString() | public function __toString() | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|Territory[] | |||||
*/ | |||||
public function getTerritory(): Collection | |||||
{ | |||||
return $this->territory; | |||||
} | |||||
public function addTerritory(Territory $territory): self | |||||
{ | |||||
if (!$this->territory->contains($territory)) { | |||||
$this->territory[] = $territory; | |||||
$territory->setIndividualData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeTerritory(Territory $territory): self | |||||
{ | |||||
if ($this->territory->removeElement($territory)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($territory->getIndividualData() === $this) { | |||||
$territory->setIndividualData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
} | } |