<?php
/**
* @author Leo BANNHOLTZER (contact@scaledev.fr)
* @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
* @license commercial
*/
declare(strict_types=1);
namespace Bluue\SalesBundle\Entity;
use Symfony\Component\Uid\Uuid;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use App\DoctrineExtensions\IsActiveEntity;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
use Bluue\SalesBundle\Repository\LineTypeRepository;
use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
/**
* @ORM\Entity(repositoryClass=LineTypeRepository::class)
* @ORM\Table(name="sales_bundle__line_type", indexes={
* @ORM\Index(name="number", columns={"number"}),
* @ORM\Index(name="is_active", columns={"is_active"}),
* @ORM\Index(name="deleted_at", columns={"deleted_at"}),
* @ORM\Index(name="created_at", columns={"created_at"}),
* @ORM\Index(name="updated_at", columns={"updated_at"})
* })
* @Gedmo\TranslationEntity(class="Bluue\SalesBundle\Entity\LineTypeTranslation")
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
*/
class LineType
{
use UserTimestampableEntity;
use UserSoftDeleteableEntity;
use IsActiveEntity;
/**
* @ORM\Id
* @ORM\Column(type="uuid")
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
private ?Uuid $id = null;
/**
* @ORM\Column(type="integer")
*/
private int $number;
/**
* @Gedmo\Translatable
* @ORM\Column(type="string", length=40)
*/
private string $name;
/**
* @ORM\OneToMany(
* targetEntity="LineTypeTranslation",
* mappedBy="object",
* cascade={"persist", "remove"},
* fetch="EXTRA_LAZY"
* )
*/
private Collection $translations;
public function __construct()
{
$this->translations = new ArrayCollection();
}
/**
* @return Uuid|null
*/
public function getId(): ?Uuid
{
return $this->id;
}
/**
* @return int
*/
public function getNumber(): int
{
return $this->number;
}
/**
* @param int $number
* @return LineType
*/
public function setNumber(int $number): self
{
$this->number = $number;
return $this;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
* @return $this
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|LineTypeTranslation[]
*/
public function getTranslations()
{
return $this->translations;
}
/**
* @param LineTypeTranslation $t
* @return $this
*/
public function addTranslation(LineTypeTranslation $t): self
{
if (!$this->translations->contains($t)) {
$this->translations[] = $t;
$t->setObject($this);
}
return $this;
}
}