You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 line
1.8KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Model\Order;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait;
  6. use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
  7. /**
  8. * @ORM\MappedSuperclass()
  9. */
  10. abstract class OrderStatusHistoryModel extends AbstractLightEntity
  11. {
  12. use BlameableNullableTrait;
  13. /**
  14. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderStatusHistories")
  15. * @ORM\JoinColumn(nullable=false)
  16. */
  17. protected $orderShop;
  18. /**
  19. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderStatusInterface")
  20. * @ORM\JoinColumn(nullable=false)
  21. */
  22. protected $orderStatus;
  23. const ORIGIN_USER = 'user';
  24. const ORIGIN_ADMIN = 'admin';
  25. const ORIGIN_SYSTEM = 'system';
  26. /**
  27. * @ORM\Column(type="string", length=31)
  28. */
  29. protected $origin;
  30. public function __toString()
  31. {
  32. return $this->getOrderStatus()->getAlias() . ' le : ' . $this->getCreatedAt()->format(
  33. 'd-m-Y H:i'
  34. ) . '(' . $this->getOrigin() . ')';
  35. }
  36. public function getOrderShop(): ?OrderShopInterface
  37. {
  38. return $this->orderShop;
  39. }
  40. public function setOrderShop(?OrderShopInterface $orderShop): self
  41. {
  42. $this->orderShop = $orderShop;
  43. return $this;
  44. }
  45. public function getOrderStatus(): ?OrderStatusInterface
  46. {
  47. return $this->orderStatus;
  48. }
  49. public function setOrderStatus(?OrderStatusInterface $orderStatus): self
  50. {
  51. $this->orderStatus = $orderStatus;
  52. return $this;
  53. }
  54. public function getOrigin(): ?string
  55. {
  56. return $this->origin;
  57. }
  58. public function setOrigin(string $origin): self
  59. {
  60. $this->origin = $origin;
  61. return $this;
  62. }
  63. }