vendor/bluue/sales-bundle/src/Entity/LineType.php line 36

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Leo BANNHOLTZER (contact@scaledev.fr)
  4.  * @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
  5.  * @license commercial
  6.  */
  7. declare(strict_types=1);
  8. namespace Bluue\SalesBundle\Entity;
  9. use Symfony\Component\Uid\Uuid;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. use App\DoctrineExtensions\IsActiveEntity;
  13. use Doctrine\Common\Collections\Collection;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  16. use Bluue\SalesBundle\Repository\LineTypeRepository;
  17. use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
  18. use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
  19. /**
  20.  * @ORM\Entity(repositoryClass=LineTypeRepository::class)
  21.  * @ORM\Table(name="sales_bundle__line_type", indexes={
  22.  *  @ORM\Index(name="number", columns={"number"}),
  23.  *  @ORM\Index(name="is_active", columns={"is_active"}),
  24.  *  @ORM\Index(name="deleted_at", columns={"deleted_at"}),
  25.  *  @ORM\Index(name="created_at", columns={"created_at"}),
  26.  *  @ORM\Index(name="updated_at", columns={"updated_at"})
  27.  * })
  28.  * @Gedmo\TranslationEntity(class="Bluue\SalesBundle\Entity\LineTypeTranslation")
  29.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
  30.  */
  31. class LineType
  32. {
  33.     use UserTimestampableEntity;
  34.     use UserSoftDeleteableEntity;
  35.     use IsActiveEntity;
  36.     /**
  37.      * @ORM\Id
  38.      * @ORM\Column(type="uuid")
  39.      * @ORM\GeneratedValue(strategy="CUSTOM")
  40.      * @ORM\CustomIdGenerator(class=UuidGenerator::class)
  41.      */
  42.     private ?Uuid $id null;
  43.     /**
  44.      * @ORM\Column(type="integer")
  45.      */
  46.     private int $number;
  47.     /**
  48.      * @Gedmo\Translatable
  49.      * @ORM\Column(type="string", length=40)
  50.      */
  51.     private string $name;
  52.     /**
  53.      * @ORM\OneToMany(
  54.      *   targetEntity="LineTypeTranslation",
  55.      *   mappedBy="object",
  56.      *   cascade={"persist", "remove"},
  57.      *   fetch="EXTRA_LAZY"
  58.      * )
  59.      */
  60.     private Collection $translations;
  61.     public function __construct()
  62.     {
  63.         $this->translations = new ArrayCollection();
  64.     }
  65.     /**
  66.      * @return Uuid|null
  67.      */
  68.     public function getId(): ?Uuid
  69.     {
  70.         return $this->id;
  71.     }
  72.     /**
  73.      * @return int
  74.      */
  75.     public function getNumber(): int
  76.     {
  77.         return $this->number;
  78.     }
  79.     /**
  80.      * @param int $number
  81.      * @return LineType
  82.      */
  83.     public function setNumber(int $number): self
  84.     {
  85.         $this->number $number;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return string
  90.      */
  91.     public function getName(): string
  92.     {
  93.         return $this->name;
  94.     }
  95.     /**
  96.      * @param string $name
  97.      * @return $this
  98.      */
  99.     public function setName(string $name): self
  100.     {
  101.         $this->name $name;
  102.         return $this;
  103.     }
  104.     /**
  105.      * @return Collection|LineTypeTranslation[]
  106.      */
  107.     public function getTranslations()
  108.     {
  109.         return $this->translations;
  110.     }
  111.     /**
  112.      * @param LineTypeTranslation $t
  113.      * @return $this
  114.      */
  115.     public function addTranslation(LineTypeTranslation $t): self
  116.     {
  117.         if (!$this->translations->contains($t)) {
  118.             $this->translations[] = $t;
  119.             $t->setObject($this);
  120.         }
  121.         return $this;
  122.     }
  123. }