src/Entity/Partner.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PartnerRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPartnerRepository::class)]
  8. #[ORM\Index(columns: ['autanet_partner_id'], name'idx_partner_autanet_partner')]
  9. class Partner
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $name null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $url null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $logo null;
  21.     #[ORM\ManyToOne]
  22.     #[ORM\JoinColumn(
  23.         name'autanet_partner_id',
  24.         referencedColumnName'id',
  25.         nullabletrue,
  26.         onDelete'SET NULL'
  27.     )]
  28.     private ?AutanetPartner $autanetPartner null;
  29.     /** @var Collection<int, PartnerStatistic> */
  30.     #[ORM\OneToMany(mappedBy'partner'targetEntityPartnerStatistic::class, orphanRemovaltrue)]
  31.     private Collection $statistics;
  32.     public function __construct()
  33.     {
  34.         $this->statistics = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getName(): ?string
  41.     {
  42.         return $this->name;
  43.     }
  44.     public function setName(string $name): self
  45.     {
  46.         $this->name $name;
  47.         return $this;
  48.     }
  49.     public function getUrl(): ?string
  50.     {
  51.         return $this->url;
  52.     }
  53.     public function setUrl(string $url): self
  54.     {
  55.         $this->url $url;
  56.         return $this;
  57.     }
  58.     public function getLogo(): ?string
  59.     {
  60.         return $this->logo;
  61.     }
  62.     public function setLogo(string $logo): self
  63.     {
  64.         $this->logo $logo;
  65.         return $this;
  66.     }
  67.     public function getAutanetPartner(): ?AutanetPartner
  68.     {
  69.         return $this->autanetPartner;
  70.     }
  71.     public function setAutanetPartner(?AutanetPartner $autanetPartner): self
  72.     {
  73.         $this->autanetPartner $autanetPartner;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return Collection<int, PartnerStatistic>
  78.      */
  79.     public function getStatistics(): Collection
  80.     {
  81.         return $this->statistics;
  82.     }
  83.     public function addStatistic(PartnerStatistic $statistic): self
  84.     {
  85.         if (!$this->statistics->contains($statistic)) {
  86.             $this->statistics->add($statistic);
  87.             $statistic->setPartner($this);
  88.         }
  89.         return $this;
  90.     }
  91.     public function removeStatistic(PartnerStatistic $statistic): self
  92.     {
  93.         if ($this->statistics->removeElement($statistic)) {
  94.             if ($statistic->getPartner() === $this) {
  95.                 $statistic->setPartner(null);
  96.             }
  97.         }
  98.         return $this;
  99.     }
  100. }