1 | <?php |
||
43 | class Place extends EventSourcedAggregateRoot implements UpdateableWithCdbXmlInterface |
||
44 | { |
||
45 | /** |
||
46 | * The actor id. |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $actorId; |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function getAggregateRootId() |
||
56 | { |
||
57 | return $this->actorId; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Factory method to create a new Place. |
||
62 | * |
||
63 | * @todo Refactor this method so it can be called create. Currently the |
||
64 | * normal behavior for create is taken by the legacy udb2 logic. |
||
65 | * The PlaceImportedFromUDB2 could be a superclass of Place. |
||
66 | * |
||
67 | * @param String $id |
||
68 | * @param Title $title |
||
69 | * @param EventType $eventType |
||
70 | * @param Address $address |
||
71 | * @param CalendarInterface $calendar |
||
72 | * @param Theme/null $theme |
||
|
|||
73 | * |
||
74 | * @return Event |
||
75 | */ |
||
76 | public static function createPlace($id, Title $title, EventType $eventType, Address $address, CalendarInterface $calendar, Theme $theme = null) |
||
77 | { |
||
78 | $place = new self(); |
||
79 | $place->apply(new PlaceCreated($id, $title, $eventType, $address, $calendar, $theme)); |
||
80 | |||
81 | return $place; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Apply the place created event. |
||
86 | * @param PlaceCreate $placeCreated |
||
87 | */ |
||
88 | protected function applyPlaceCreated(PlaceCreated $placeCreated) |
||
89 | { |
||
90 | $this->actorId = $placeCreated->getPlaceId(); |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @param string $description |
||
95 | */ |
||
96 | public function updateDescription($description) |
||
97 | { |
||
98 | $this->apply(new DescriptionUpdated($this->actorId, $description)); |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * @param string $typicalAgeRange |
||
103 | */ |
||
104 | public function updateTypicalAgeRange($typicalAgeRange) |
||
105 | { |
||
106 | $this->apply(new TypicalAgeRangeUpdated($this->actorId, $typicalAgeRange)); |
||
107 | } |
||
108 | |||
109 | public function deleteTypicalAgeRange() |
||
110 | { |
||
111 | $this->apply(new TypicalAgeRangeDeleted($this->actorId)); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * Handle an update command to update organizer. |
||
116 | */ |
||
117 | public function updateOrganizer($organizerId) |
||
118 | { |
||
119 | $this->apply(new OrganizerUpdated($this->actorId, $organizerId)); |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * Delete the given organizer. |
||
124 | * |
||
125 | * @param string $organizerId |
||
126 | */ |
||
127 | public function deleteOrganizer($organizerId) |
||
128 | { |
||
129 | $this->apply(new OrganizerDeleted($this->actorId, $organizerId)); |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * Updated the contact point. |
||
134 | * |
||
135 | * @param ContactPoint $contactPoint |
||
136 | */ |
||
137 | public function updateContactPoint(ContactPoint $contactPoint) |
||
138 | { |
||
139 | $this->apply(new ContactPointUpdated($this->actorId, $contactPoint)); |
||
140 | } |
||
141 | |||
142 | /** |
||
143 | * Updated the booking info. |
||
144 | * |
||
145 | * @param BookingInfo $bookingInfo |
||
146 | */ |
||
147 | public function updateBookingInfo(BookingInfo $bookingInfo) |
||
148 | { |
||
149 | $this->apply(new BookingInfoUpdated($this->actorId, $bookingInfo)); |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * Update the facilities. |
||
154 | * |
||
155 | * @param array $facilities |
||
156 | */ |
||
157 | public function updateFacilities(array $facilities) |
||
158 | { |
||
159 | $this->apply(new FacilitiesUpdated($this->actorId, $facilities)); |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | * Add a new image. |
||
164 | * |
||
165 | * @param Image $image |
||
166 | */ |
||
167 | public function addImage(Image $image) |
||
168 | { |
||
169 | $this->apply(new ImageAdded($this->actorId, $image)); |
||
170 | } |
||
171 | |||
172 | /** |
||
173 | * @param UpdateImage $updateImageCommand |
||
174 | */ |
||
175 | public function updateImage(UpdateImage $updateImageCommand) |
||
176 | { |
||
177 | $this->apply(new ImageUpdated( |
||
178 | $updateImageCommand->getItemId(), |
||
179 | $updateImageCommand->getMediaObjectId(), |
||
180 | $updateImageCommand->getDescription(), |
||
181 | $updateImageCommand->getCopyrightHolder() |
||
182 | )); |
||
183 | } |
||
184 | |||
185 | /** |
||
186 | * Remove an image. |
||
187 | * |
||
188 | * @param Image $image |
||
189 | */ |
||
190 | public function removeImage(Image $image) |
||
191 | { |
||
192 | $this->apply(new ImageRemoved($this->actorId, $image)); |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | * Update the major info. |
||
197 | * |
||
198 | * @param Title $title |
||
199 | * @param EventType $eventType |
||
200 | * @param Address $address |
||
201 | * @param CalendarInterface $calendar |
||
202 | * @param type $theme |
||
203 | */ |
||
204 | public function updateMajorInfo(Title $title, EventType $eventType, Address $address, CalendarInterface $calendar, $theme = null) |
||
208 | |||
209 | /** |
||
210 | * Delete this item. |
||
211 | */ |
||
212 | public function deletePlace() |
||
216 | |||
217 | /** |
||
218 | * Import from UDB2. |
||
219 | * |
||
220 | * @param string $actorId |
||
221 | * The actor id. |
||
222 | * @param string $cdbXml |
||
223 | * The cdb xml. |
||
224 | * @param string $cdbXmlNamespaceUri |
||
225 | * The cdb xml namespace uri. |
||
226 | * |
||
227 | * @return Actor |
||
228 | * The actor. |
||
229 | */ |
||
230 | public static function importFromUDB2Actor( |
||
246 | |||
247 | /** |
||
248 | * Import from UDB2. |
||
249 | * |
||
250 | * @param string $placeId |
||
251 | * The actor id. |
||
252 | * @param string $cdbXml |
||
253 | * The cdb xml. |
||
254 | * @param string $cdbXmlNamespaceUri |
||
255 | * The cdb xml namespace uri. |
||
256 | * |
||
257 | * @return Actor |
||
258 | * The actor. |
||
259 | */ |
||
260 | public static function importFromUDB2Event( |
||
276 | |||
277 | public function applyPlaceImportedFromUDB2( |
||
282 | |||
283 | public function applyPlaceImportedFromUDB2Event( |
||
288 | |||
289 | /** |
||
290 | * @inheritdoc |
||
291 | */ |
||
292 | public function updateWithCdbXml($cdbXml, $cdbXmlNamespaceUri) |
||
302 | } |
||
303 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.