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. /**
  13. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderStatusHistories")
  14. * @ORM\JoinColumn(nullable=false)
  15. */
  16. protected $orderShop;
  17. /**
  18. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderStatusInterface")
  19. * @ORM\JoinColumn(nullable=false)
  20. */
  21. protected $orderStatus;
  22. const ORIGIN_USER = 'user';
  23. const ORIGIN_ADMIN = 'admin';
  24. const ORIGIN_SYSTEM = 'system';
  25. /**
  26. * @ORM\Column(type="string", length=31)
  27. */
  28. protected $origin;
  29. public function __toString()
  30. {
  31. return $this->getOrderStatus()->getAlias() . ' le : ' . $this->getCreatedAt()->format(
  32. 'd-m-Y H:i'
  33. ) . '(' . $this->getOrigin() . ')';
  34. }
  35. public function getOrderShop(): ?OrderShopInterface
  36. {
  37. return $this->orderShop;
  38. }
  39. public function setOrderShop(?OrderShopInterface $orderShop): self
  40. {
  41. $this->orderShop = $orderShop;
  42. return $this;
  43. }
  44. public function getOrderStatus(): ?OrderStatusInterface
  45. {
  46. return $this->orderStatus;
  47. }
  48. public function setOrderStatus(?OrderStatusInterface $orderStatus): self
  49. {
  50. $this->orderStatus = $orderStatus;
  51. return $this;
  52. }
  53. public function getOrigin(): ?string
  54. {
  55. return $this->origin;
  56. }
  57. public function setOrigin(string $origin): self
  58. {
  59. $this->origin = $origin;
  60. return $this;
  61. }
  62. }