@@ 267-276 (lines=10) @@ | ||
264 | * @return boolean |
|
265 | * true on successful creation |
|
266 | */ |
|
267 | public function create(Entity $entity) |
|
268 | { |
|
269 | $result = $this->events->shouldExecute($entity, 'before', 'create'); |
|
270 | if (!$result) { |
|
271 | return false; |
|
272 | } |
|
273 | $result = $this->doCreate($entity); |
|
274 | $this->events->shouldExecute($entity, 'after', 'create'); |
|
275 | return $result; |
|
276 | } |
|
277 | ||
278 | /** |
|
279 | * Updates an existing entry in the datasource having the same id. |
|
@@ 287-295 (lines=9) @@ | ||
284 | * @return boolean |
|
285 | * true on successful update |
|
286 | */ |
|
287 | public function update(Entity $entity) |
|
288 | { |
|
289 | if (!$this->events->shouldExecute($entity, 'before', 'update')) { |
|
290 | return false; |
|
291 | } |
|
292 | $result = $this->doUpdate($entity); |
|
293 | $this->events->shouldExecute($entity, 'after', 'update'); |
|
294 | return $result; |
|
295 | } |
|
296 | ||
297 | /** |
|
298 | * Deletes an entry from the datasource. |