<?php namespace Lc\ShopBundle\Model; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; /** * @ORM\MappedSuperclass() */ abstract class OrderStatus { const ALIAS_CART = 'cart' ; const ALIAS_CART_CANCELED = 'cart-canceled' ; const ALIAS_WAITING_PAYMENT_ONLINE = 'waiting-payment-online' ; const ALIAS_WAITING_PAYMENT_CREDIT = 'waiting-payment-credit' ; const ALIAS_PAID_ONLINE = 'paid-online' ; const ALIAS_ERROR_PAYMENT_ONLINE = 'error-payment-online' ; const ALIAS_PAID_BY_CREDIT = 'paid-by-credit' ; const ALIAS_WAITING_DELIVERY = 'waiting-delivery' ; const ALIAS_DONE = 'done' ; const ALIAS_CANCELED = 'canceled' ; const ALIAS_CANCELED_WAITING_REFUND = 'canceled-waiting-refund' ; const ALIAS_REFUND = 'refund' ; /** * @ORM\Column(type="string", length=255) */ protected $title; /** * @ORM\Column(type="text", nullable=true) */ protected $description; /** * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\OrderStatusInterface") */ protected $nextStatusAllowed; /** * @ORM\Column(type="string", length=255) */ protected $alias; public function __toString() { return $this->title. ' ['.$this->alias.']'; } public function __construct() { $this->nextStatusAllowed = new ArrayCollection(); } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } /** * @return Collection|self[] */ public function getNextStatusAllowed(): Collection { return $this->nextStatusAllowed; } public function addNextStatusAllowed(self $nextStatusAllowed): self { if (!$this->nextStatusAllowed->contains($nextStatusAllowed)) { $this->nextStatusAllowed[] = $nextStatusAllowed; } return $this; } public function removeNextStatusAllowed(self $nextStatusAllowed): self { if ($this->nextStatusAllowed->contains($nextStatusAllowed)) { $this->nextStatusAllowed->removeElement($nextStatusAllowed); } return $this; } public function getAlias(): ?string { return $this->alias; } public function setAlias(string $alias): self { $this->alias = $alias; return $this; } }