src/Entity/Package.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PackageRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass:PackageRepository::class)]
  8. class Package
  9. {
  10.     public function __construct()
  11.     {
  12.         $this->persons = new ArrayCollection();
  13.     }
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue(strategy'AUTO')]
  16.     #[ORM\Column(type'integer'uniquetrue)]
  17.     private $id;
  18.     #[ORM\Column(type'string'length60uniquetrue)]
  19.     private $type;
  20.     #[ORM\ManyToMany(targetEntity'App\Entity\Person'mappedBy'packages'cascade: ['persist'])]
  21.     protected $persons;
  22.     /**
  23.      * @return mixed
  24.      */
  25.     public function getPersons()
  26.     {
  27.         return $this->persons;
  28.     }
  29.     public function addPerson(Person $person){
  30.         $this->persons->add($person);
  31.     }
  32.     public function removePerson(Person $person){
  33.         $this->persons->removeElement($person);
  34.     }
  35.     #[ORM\Column(type'integer'nullabletrue)]
  36.     private $unicity;
  37.     #[ORM\OneToOne(targetEntityAdapterContent::class, mappedBy'package'cascade: ['persist''remove'])]
  38.     private $adapterContent;
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getType(): ?string
  44.     {
  45.         return $this->type;
  46.     }
  47.     public function setType(string $type): self
  48.     {
  49.         $this->type $type;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection<int, Person>
  54.      */
  55.     public function getPerson(): Collection
  56.     {
  57.         return $this->person;
  58.     }
  59.     /*public function addPerson(Person $person): self
  60.     {
  61.         if (!$this->person->contains($person)) {
  62.             $this->person[] = $person;
  63.             $person->setPackage($this);
  64.         }
  65.         return $this;
  66.     }*/
  67.    /* public function removePerson(Person $person): self
  68.     {
  69.         if ($this->person->removeElement($person)) {
  70.             // set the owning side to null (unless already changed)
  71.             if ($person->getPackage() === $this) {
  72.                 $person->setPackage(null);
  73.             }
  74.         }
  75.         return $this;
  76.     }*/
  77.     public function getUnicity(): ?int
  78.     {
  79.         return $this->unicity;
  80.     }
  81.     public function setUnicity(?int $unicity): self
  82.     {
  83.         $this->unicity $unicity;
  84.         return $this;
  85.     }
  86.     public function getAdapterContent(): ?AdapterContent
  87.     {
  88.         return $this->adapterContent;
  89.     }
  90.     public function setAdapterContent(AdapterContent $adapterContent): self
  91.     {
  92.         // unset the owning side of the relation if necessary
  93.         if ($adapterContent === null && $this->adapterContent !== null) {
  94.             $this->adapterContent->setPackage(null);
  95.         }
  96.         // set the owning side of the relation if necessary
  97.         if ($adapterContent !== null && $adapterContent->getPackage() !== $this) {
  98.             $adapterContent->setPackage($this);
  99.         }
  100.         $this->adapterContent $adapterContent;
  101.         return $this;
  102.     }
  103. }