<?php
/**
* @author Quentin CHATELAIN (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 Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
use Gedmo\Mapping\Annotation as Gedmo;
use Bluue\SalesBundle\Repository\PaymentMethodRepository;
use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
use App\DoctrineExtensions\IsActiveEntity;
/**
* @ORM\Entity(repositoryClass=PaymentMethodRepository::class)
* @ORM\Table(name="sales_bundle__payment_method", indexes={
* @ORM\Index(name="name", columns={"name"}),
* @ORM\Index(name="is_invoice", columns={"is_invoice"}),
* @ORM\Index(name="is_credit_note", columns={"is_credit_note"}),
* @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\PaymentMethodTranslation")
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
*/
class PaymentMethod
{
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;
/**
* @Gedmo\Translatable
* @ORM\Column(type="string", length=128)
*/
private ?string $name = null;
/**
* @ORM\Column(type="boolean")
*/
private bool $is_invoice = false;
/**
* @ORM\Column(type="boolean")
*/
private bool $is_credit_note = false;
/**
* @ORM\OneToMany(
* targetEntity="PaymentMethodTranslation",
* mappedBy="object",
* cascade={"persist", "remove"},
* fetch="EXTRA_LAZY"
* )
*/
private Collection $translations;
/**
* @ORM\ManyToOne(targetEntity=Bank::class, inversedBy="paymentMethods")
* @ORM\JoinColumn(nullable=true)
*/
private ?Bank $bank = null;
public function __construct()
{
$this->translations = new ArrayCollection();
}
/**
* @return Uuid|null
*/
public function getId(): ?Uuid
{
return $this->id;
}
/**
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @return Collection|PaymentMethodTranslation[]
*/
public function getTranslations(): Collection
{
return $this->translations;
}
/**
* @param string $name
* @return PaymentMethod
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return bool
*/
public function isIsInvoice(): bool
{
return $this->is_invoice;
}
/**
* @param bool $is_invoice
* @return PaymentMethod
*/
public function setIsInvoice(bool $is_invoice): self
{
$this->is_invoice = $is_invoice;
return $this;
}
/**
* @return bool
*/
public function isIsCreditNote(): bool
{
return $this->is_credit_note;
}
/**
* @param bool $is_credit_note
* @return PaymentMethod
*/
public function setIsCreditNote(bool $is_credit_note): self
{
$this->is_credit_note = $is_credit_note;
return $this;
}
/**
* @param PaymentMethodTranslation $t
* @return $this
*/
public function addTranslation(PaymentMethodTranslation $t): self
{
if (!$this->translations->contains($t)) {
$this->translations[] = $t;
$t->setObject($this);
}
return $this;
}
/**
* @param Bank|null $bank
* @return $this
*/
public function setBank(?Bank $bank): self
{
$this->bank = $bank;
return $this;
}
/**
* @return Bank|null
*/
public function getBank(): ?Bank
{
return $this->bank;
}
}