vendor/bluue/sales-bundle/src/Entity/PaymentTerm.php line 42

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Quentin CHATELAIN (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 Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\Uid\Uuid;
  13. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  14. use Gedmo\Mapping\Annotation as Gedmo;
  15. use Bluue\SalesBundle\Repository\PaymentTermRepository;
  16. use Bluue\SalesBundle\EventListener\PaymentTermListener;
  17. use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
  18. use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
  19. use App\DoctrineExtensions\IsActiveEntity;
  20. use App\DoctrineExtensions\IsDefaultEntity;
  21. /**
  22.  * @ORM\Entity(repositoryClass=PaymentTermRepository::class)
  23.  * @ORM\Table(name="sales_bundle__payment_term", indexes={
  24.  *  @ORM\Index(name="name", columns={"name"}),
  25.  *  @ORM\Index(name="days_delay", columns={"days_delay"}),
  26.  *  @ORM\Index(name="end_month", columns={"end_month"}),
  27.  *  @ORM\Index(name="is_active", columns={"is_active"}),
  28.  *  @ORM\Index(name="is_default", columns={"is_default"}),
  29.  *  @ORM\Index(name="deleted_at", columns={"deleted_at"}),
  30.  *  @ORM\Index(name="created_at", columns={"created_at"}),
  31.  *  @ORM\Index(name="updated_at", columns={"updated_at"})
  32.  * })
  33.  * @Gedmo\TranslationEntity(class="Bluue\SalesBundle\Entity\PaymentTermTranslation")
  34.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
  35.  * @ORM\EntityListeners({PaymentTermListener::class})
  36.  */
  37. class PaymentTerm
  38. {
  39.     use UserTimestampableEntity;
  40.     use UserSoftDeleteableEntity;
  41.     use IsActiveEntity;
  42.     use IsDefaultEntity;
  43.     /**
  44.      * @ORM\Id
  45.      * @ORM\Column(type="uuid")
  46.      * @ORM\GeneratedValue(strategy="CUSTOM")
  47.      * @ORM\CustomIdGenerator(class=UuidGenerator::class)
  48.      */
  49.     private ?Uuid $id null;
  50.     /**
  51.      * @Gedmo\Translatable
  52.      * @ORM\Column(type="string", length=128)
  53.      */
  54.     private ?string $name null;
  55.     /**
  56.      * @ORM\Column(type="integer")
  57.      */
  58.     private ?int $days_delay null;
  59.     /**
  60.      * @ORM\Column(type="boolean")
  61.      */
  62.     private bool $end_month false;
  63.     /**
  64.      * @ORM\OneToMany(
  65.      *   targetEntity="PaymentTermTranslation",
  66.      *   mappedBy="object",
  67.      *   cascade={"persist", "remove"},
  68.      *   fetch="EXTRA_LAZY"
  69.      * )
  70.      */
  71.     private Collection $translations;
  72.     public function __construct()
  73.     {
  74.         $this->translations = new ArrayCollection();
  75.     }
  76.     /**
  77.      * @return Uuid|null
  78.      */
  79.     public function getId(): ?Uuid
  80.     {
  81.         return $this->id;
  82.     }
  83.     /**
  84.      * @return string|null
  85.      */
  86.     public function getName(): ?string
  87.     {
  88.         return $this->name;
  89.     }
  90.     /**
  91.      * @param string $name
  92.      * @return PaymentTerm
  93.      */
  94.     public function setName(string $name): self
  95.     {
  96.         $this->name $name;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return int|null
  101.      */
  102.     public function getDaysDelay(): ?int
  103.     {
  104.         return $this->days_delay;
  105.     }
  106.     /**
  107.      * @param int $days_delay
  108.      * @return PaymentTerm
  109.      */
  110.     public function setDaysDelay(int $days_delay): self
  111.     {
  112.         $this->days_delay $days_delay;
  113.         return $this;
  114.     }
  115.     /**
  116.      * @return bool|null
  117.      */
  118.     public function getEndMonth(): ?bool
  119.     {
  120.         return $this->end_month;
  121.     }
  122.     /**
  123.      * @param bool $end_month
  124.      * @return PaymentTerm
  125.      */
  126.     public function setEndMonth(bool $end_month): self
  127.     {
  128.         $this->end_month $end_month;
  129.         return $this;
  130.     }
  131.     /**
  132.      * @return Collection|PaymentTermTranslation[]
  133.      */
  134.     public function getTranslations(): Collection
  135.     {
  136.         return $this->translations;
  137.     }
  138.     /**
  139.      * @param PaymentTermTranslation $t
  140.      * @return PaymentTerm
  141.      */
  142.     public function addTranslation(PaymentTermTranslation $t): self
  143.     {
  144.         if (!$this->translations->contains($t)) {
  145.             $this->translations[] = $t;
  146.             $t->setObject($this);
  147.         }
  148.         return $this;
  149.     }
  150. }