|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?php
-
- namespace Lc\CaracoleBundle\Model\Order;
-
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Lc\SovBundle\Doctrine\EntityInterface;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class OrderStatusModel implements EntityInterface
- {
- const ALIAS_CART = 'cart';
- const ALIAS_CART_CANCELED = 'cart-canceled';
- const ALIAS_WAITING_PAYMENT_ONLINE = 'waiting-payment-online';
- const ALIAS_WAITING_BANK_RETURN = 'waiting-bank-return';
- const ALIAS_PARTIAL_PAYMENT = 'partial-payment';
- const ALIAS_PAID = 'paid';
- const ALIAS_ERROR_PAYMENT_ONLINE = 'error-payment-online';
- const ALIAS_WAITING_DELIVERY = 'waiting-delivery';
- const ALIAS_WAITING_DELIVERY_WITH_PAYMENT = 'waiting-delivery-with-payment';
- const ALIAS_DELIVERED_WITHOUT_PAYMENT = 'delivered-without-payment';
- const ALIAS_DONE = 'done';
- const ALIAS_CANCELED = 'canceled';
- const ALIAS_CANCELED_WAITING_REFUND = 'canceled-waiting-refund';
- const ALIAS_REFUND = 'refund';
-
- //TODO : AJOUTER un champ valid ds orderSTATUS
- static $statusAliasAsValid = [
- self::ALIAS_PAID,
- self::ALIAS_WAITING_DELIVERY,
- self::ALIAS_WAITING_BANK_RETURN,
- self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT,
- self::ALIAS_DELIVERED_WITHOUT_PAYMENT,
- self::ALIAS_DONE
- ];
-
- static $statusAliasWaitingDelivery = [
- self::ALIAS_WAITING_DELIVERY,
- self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT,
- ];
-
- static $statusAliasAsCart = [
- self::ALIAS_CART,
- self::ALIAS_PARTIAL_PAYMENT,
- self::ALIAS_WAITING_PAYMENT_ONLINE,
- self::ALIAS_ERROR_PAYMENT_ONLINE
- ];
-
- /**
- * @ORM\Column(type="string", length=255)
- */
- protected $title;
-
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- protected $description;
-
- /**
- * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Order\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;
- }
-
-
- }
|