src/Entity/InformativePills/InformativePillFamily.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity\InformativePills;
  3. use App\Annotation\SiteAware;
  4. use App\Entity\AbstractBase;
  5. use App\Entity\Interfaces\SiteInterface;
  6. use App\Entity\MiniAbstractBase;
  7. use App\Entity\Traits\ActiveTrait;
  8. use App\Entity\Traits\DescriptionTrait;
  9. use App\Entity\Traits\IsGripsTrait;
  10. use App\Entity\Traits\NameTrait;
  11. use App\Entity\Traits\SiteTrait;
  12. use App\Repository\InformativePills\InformativePillFamilyRepository;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\Common\Collections\Collection;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Gedmo\Mapping\Annotation as Gedmo;
  17. /**
  18.  * @ORM\Table(name="vulco_informative_pill_family", indexes={@ORM\Index(name="informative_pill_family_site_idx", columns={"site"})})
  19.  * @ORM\Entity(repositoryClass=InformativePillFamilyRepository::class)
  20.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  21.  * @SiteAware(siteFieldName="site")
  22.  */
  23. class InformativePillFamily extends AbstractBase implements SiteInterface
  24. {
  25.     use ActiveTrait;
  26.     use DescriptionTrait;
  27.     use IsGripsTrait;
  28.     use NameTrait;
  29.     use SiteTrait;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=false)
  32.      */
  33.     private string $name;
  34.     /**
  35.      * @ORM\Column(type="text", length=10000, nullable=true)
  36.      */
  37.     private ?string $description;
  38.     /**
  39.      * @ORM\Column(type="boolean", nullable=false, options={"default": 1})
  40.      */
  41.     private bool $active true;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity="App\Entity\InformativePills\InformativePill", mappedBy="family")
  44.      */
  45.     private ?Collection $informativePills;
  46.     public function __construct()
  47.     {
  48.         $this->informativePills = new ArrayCollection();
  49.     }
  50.     public function getInformativePills(): ?Collection
  51.     {
  52.         return $this->informativePills;
  53.     }
  54.     public function getInformativePillsAmount(): int
  55.     {
  56.         return $this->getInformativePills() ? $this->getInformativePills()->count() : 0;
  57.     }
  58.     public function setInformativePills(?Collection $informativePills): self
  59.     {
  60.         $this->informativePills $informativePills;
  61.         return $this;
  62.     }
  63.     public function __toString(): string
  64.     {
  65.         return $this->id $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  66.     }
  67. }