<?php
namespace App\Entity\InformativePills;
use App\Annotation\SiteAware;
use App\Entity\AbstractBase;
use App\Entity\Interfaces\SiteInterface;
use App\Entity\MiniAbstractBase;
use App\Entity\Traits\ActiveTrait;
use App\Entity\Traits\DescriptionTrait;
use App\Entity\Traits\IsGripsTrait;
use App\Entity\Traits\NameTrait;
use App\Entity\Traits\SiteTrait;
use App\Repository\InformativePills\InformativePillFamilyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Table(name="vulco_informative_pill_family", indexes={@ORM\Index(name="informative_pill_family_site_idx", columns={"site"})})
* @ORM\Entity(repositoryClass=InformativePillFamilyRepository::class)
* @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
* @SiteAware(siteFieldName="site")
*/
class InformativePillFamily extends AbstractBase implements SiteInterface
{
use ActiveTrait;
use DescriptionTrait;
use IsGripsTrait;
use NameTrait;
use SiteTrait;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private string $name;
/**
* @ORM\Column(type="text", length=10000, nullable=true)
*/
private ?string $description;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default": 1})
*/
private bool $active = true;
/**
* @ORM\OneToMany(targetEntity="App\Entity\InformativePills\InformativePill", mappedBy="family")
*/
private ?Collection $informativePills;
public function __construct()
{
$this->informativePills = new ArrayCollection();
}
public function getInformativePills(): ?Collection
{
return $this->informativePills;
}
public function getInformativePillsAmount(): int
{
return $this->getInformativePills() ? $this->getInformativePills()->count() : 0;
}
public function setInformativePills(?Collection $informativePills): self
{
$this->informativePills = $informativePills;
return $this;
}
public function __toString(): string
{
return $this->id ? $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
}
}