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