1 | <?php |
||
19 | class CustomerOrder |
||
20 | { |
||
21 | use TimestampableTrait; |
||
22 | |||
23 | const STATUS_PENDING = 'pending'; |
||
24 | const STATUS_PAID = 'paid'; |
||
25 | const STATUS_REJECTED = 'rejected'; |
||
26 | |||
27 | /** |
||
28 | * @var Uuid |
||
29 | * |
||
30 | * @ORM\Column(name="id", type="uuid_binary") |
||
31 | * @ORM\Id |
||
32 | * @ORM\GeneratedValue(strategy="UUID") |
||
33 | */ |
||
34 | private $id; |
||
35 | |||
36 | /** |
||
37 | * @var ArrayCollection|Ticket[] |
||
38 | * |
||
39 | * @ORM\OneToMany( |
||
40 | * targetEntity="AppBundle\Entity\Ticket", |
||
41 | * mappedBy="object", |
||
42 | * cascade={"persist", "remove"} |
||
43 | * ) |
||
44 | */ |
||
45 | protected $tickets; |
||
46 | |||
47 | /** |
||
48 | * @var Enum |
||
49 | * @Assert\Choice(callback="getStatuses") |
||
50 | * @ORM\Column(name="status", type="string", columnDefinition="enum('free', 'booked', 'ordered')") |
||
51 | * @Expose() |
||
52 | */ |
||
53 | protected $status; |
||
54 | |||
55 | /** |
||
56 | * CustomerOrder constructor. |
||
57 | */ |
||
58 | public function __construct() |
||
63 | |||
64 | /** |
||
65 | * @return Uuid |
||
66 | */ |
||
67 | public function getId() |
||
71 | |||
72 | /** |
||
73 | * @return Ticket[]|ArrayCollection |
||
74 | */ |
||
75 | public function getTickets() |
||
79 | |||
80 | /** |
||
81 | * @param Ticket[]|ArrayCollection $tickets |
||
82 | */ |
||
83 | public function setTickets($tickets) |
||
87 | |||
88 | /** |
||
89 | * @return Enum |
||
90 | */ |
||
91 | public function getStatus() |
||
95 | |||
96 | /** |
||
97 | * @param Enum $status |
||
98 | */ |
||
99 | public function setStatus($status) |
||
103 | |||
104 | /** |
||
105 | * Add Ticket |
||
106 | * |
||
107 | * @param Ticket $ticket |
||
108 | * @return CustomerOrder |
||
109 | */ |
||
110 | public function addTicket(Ticket $ticket) |
||
119 | |||
120 | /** |
||
121 | * @param Ticket $ticket |
||
122 | */ |
||
123 | public function removeTicket(Ticket $ticket) |
||
130 | |||
131 | /** |
||
132 | * @return bool |
||
133 | */ |
||
134 | private function isStatusPaid() |
||
138 | /** |
||
139 | * @return array |
||
140 | */ |
||
141 | public static function getStatuses() |
||
149 | } |
||
150 |