1 | <?php |
||
24 | abstract class AbstractBaseService |
||
25 | { |
||
26 | const EVENT_CREATE = null; |
||
27 | const EVENT_CREATE_BEFORE = null; |
||
28 | const EVENT_CREATE_AFTER = null; |
||
29 | const EVENT_UPDATE = null; |
||
30 | const EVENT_UPDATE_BEFORE = null; |
||
31 | const EVENT_UPDATE_AFTER = null; |
||
32 | const EVENT_DELETE = null; |
||
33 | const EVENT_DELETE_BEFORE = null; |
||
34 | const EVENT_DELETE_AFTER = null; |
||
35 | |||
36 | protected $dispatcher; |
||
37 | |||
38 | //CREATION |
||
39 | |||
40 | /** |
||
41 | * Allow to proccess Creation Even Sender |
||
42 | * @param Event $event |
||
43 | */ |
||
44 | protected function create(Event $event) |
||
54 | |||
55 | /** |
||
56 | * Allow to create an object from an Event |
||
57 | * @param Event $event |
||
58 | */ |
||
59 | protected function createProcess(Event $event) |
||
63 | |||
64 | // UPDATE |
||
65 | |||
66 | /** |
||
67 | * Allow to send Update Events |
||
68 | * @param Event $event |
||
69 | */ |
||
70 | protected function update(Event $event) |
||
80 | |||
81 | |||
82 | /** |
||
83 | * Allow to update an object from an event |
||
84 | * @param Event $event |
||
85 | */ |
||
86 | protected function updateProcess(Event $event) |
||
90 | |||
91 | // DELETE |
||
92 | |||
93 | protected function delete(Event $event) |
||
103 | |||
104 | protected function deleteProcess(Event $event) |
||
108 | |||
109 | |||
110 | // DEPENDENCIES |
||
111 | |||
112 | /** |
||
113 | * Dispatch a Thelia event |
||
114 | * |
||
115 | * @param string $eventName a TheliaEvent name, as defined in TheliaEvents class |
||
116 | * @param ActionEvent $event the action event, or null (a DefaultActionEvent will be dispatched) |
||
117 | */ |
||
118 | protected function dispatch($eventName, Event $event = null) |
||
126 | |||
127 | /** |
||
128 | * Return the event dispatcher, |
||
129 | * |
||
130 | * @return \Symfony\Component\EventDispatcher\EventDispatcher |
||
131 | */ |
||
132 | public function getDispatcher() |
||
136 | |||
137 | public function setDispatcher(EventDispatcher $dispatcher) |
||
141 | } |
||
142 |