Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

93 lines
2.1KB

  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\Pattern\AbstractLightEntity;
  6. /**
  7. * @ORM\MappedSuperclass()
  8. */
  9. abstract class OrderStatusHistoryModel extends AbstractLightEntity
  10. {
  11. /**
  12. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderStatusHistories")
  13. * @ORM\JoinColumn(nullable=false)
  14. */
  15. protected $orderShop;
  16. /**
  17. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderStatusInterface")
  18. * @ORM\JoinColumn(nullable=false)
  19. */
  20. protected $orderStatus;
  21. const ORIGIN_USER = 'user';
  22. const ORIGIN_ADMIN = 'admin';
  23. const ORIGIN_SYSTEM = 'system';
  24. /**
  25. * @ORM\Column(type="string", length=31)
  26. */
  27. protected $origin;
  28. /**
  29. * @Gedmo\Blameable(on="create")
  30. * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
  31. * @ORM\JoinColumn(nullable=true)
  32. */
  33. protected $createdBy;
  34. /**
  35. * @Gedmo\Blameable(on="update")
  36. * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
  37. * @ORM\JoinColumn(nullable=true)
  38. */
  39. protected $updatedBy;
  40. public function __toString()
  41. {
  42. return $this->getOrderStatus()->getAlias() . ' le : ' . $this->getCreatedAt()->format(
  43. 'd-m-Y H:i'
  44. ) . '(' . $this->getOrigin() . ')';
  45. }
  46. public function getOrderShop(): ?OrderShopInterface
  47. {
  48. return $this->orderShop;
  49. }
  50. public function setOrderShop(?OrderShopInterface $orderShop): self
  51. {
  52. $this->orderShop = $orderShop;
  53. return $this;
  54. }
  55. public function getOrderStatus(): ?OrderStatusInterface
  56. {
  57. return $this->orderStatus;
  58. }
  59. public function setOrderStatus(?OrderStatusInterface $orderStatus): self
  60. {
  61. $this->orderStatus = $orderStatus;
  62. return $this;
  63. }
  64. public function getOrigin(): ?string
  65. {
  66. return $this->origin;
  67. }
  68. public function setOrigin(string $origin): self
  69. {
  70. $this->origin = $origin;
  71. return $this;
  72. }
  73. }