1 | <?php |
||
18 | class ModelEvent extends Event |
||
19 | { |
||
20 | /** EVENT: Insert a new Document */ |
||
21 | const MODEL_EVENT_INSERT = 'document.model.event.insert'; |
||
22 | |||
23 | /** EVENT: Update a new Document */ |
||
24 | const MODEL_EVENT_UPDATE = 'document.model.event.update'; |
||
25 | |||
26 | /** EVENT: Delete a new Document */ |
||
27 | const MODEL_EVENT_DELETE = 'document.model.event.delete'; |
||
28 | |||
29 | /** |
||
30 | * @var array list with event names |
||
31 | */ |
||
32 | private $availableEvents = [ |
||
33 | self::MODEL_EVENT_INSERT => 'insert', |
||
34 | self::MODEL_EVENT_UPDATE => 'update', |
||
35 | self::MODEL_EVENT_DELETE => 'delete' |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * Containing operation executed |
||
40 | * update or insert |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | private $action; |
||
45 | |||
46 | /** |
||
47 | * Containing the ID of the Model on which the change happened |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | private $collectionId; |
||
52 | |||
53 | /** |
||
54 | * Containing the name of the Collection affected |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | private $collectionName; |
||
59 | |||
60 | /** |
||
61 | * Containing the name of the Collection affected |
||
62 | * |
||
63 | * @var string |
||
64 | */ |
||
65 | private $collectionClass; |
||
66 | |||
67 | /** |
||
68 | * Containing the changed object collection |
||
69 | * |
||
70 | * @var Object |
||
71 | */ |
||
72 | private $collection; |
||
73 | |||
74 | /** |
||
75 | * Set the event ACTION name based on the fired name |
||
76 | * |
||
77 | * @param string $dispatchName the CONST value for dispatch names |
||
78 | * |
||
79 | * @return string |
||
|
|||
80 | * @throws Exception |
||
81 | */ |
||
82 | public function setActionByDispatchName($dispatchName) |
||
90 | |||
91 | /** |
||
92 | * @return string |
||
93 | */ |
||
94 | public function getAction() |
||
98 | |||
99 | /** |
||
100 | * @return string Collection ID |
||
101 | */ |
||
102 | public function getCollectionId() |
||
106 | |||
107 | /** |
||
108 | * @param string $collectionId Collection ID |
||
109 | * @return void |
||
110 | */ |
||
111 | public function setCollectionId($collectionId) |
||
115 | |||
116 | /** |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getCollectionName() |
||
123 | |||
124 | /** |
||
125 | * @param string $collectionName Name to Be |
||
126 | * @return void |
||
127 | */ |
||
128 | public function setCollectionName($collectionName) |
||
132 | |||
133 | /** |
||
134 | * @return string |
||
135 | */ |
||
136 | public function getCollectionClass() |
||
140 | |||
141 | /** |
||
142 | * @param string $collectionClass Collection Class |
||
143 | * @return void |
||
144 | */ |
||
145 | public function setCollectionClass($collectionClass) |
||
149 | |||
150 | /** |
||
151 | * @return Object |
||
152 | */ |
||
153 | public function getCollection() |
||
157 | |||
158 | /** |
||
159 | * @param Object $collection Collection Object |
||
160 | * @return void |
||
161 | */ |
||
162 | public function setCollection($collection) |
||
166 | } |
||
167 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.