| @@ 1322-1335 (lines=14) @@ | ||
| 1319 | * |
|
| 1320 | * @return bool |
|
| 1321 | */ |
|
| 1322 | private function beforeCreate() |
|
| 1323 | { |
|
| 1324 | $event = $this->dispatch(ModelEvent::CREATING); |
|
| 1325 | if ($event->isPropagationStopped()) { |
|
| 1326 | return false; |
|
| 1327 | } |
|
| 1328 | ||
| 1329 | // TODO deprecated |
|
| 1330 | if (method_exists($this, 'preCreateHook') && !$this->preCreateHook($this->_unsaved)) { |
|
| 1331 | return false; |
|
| 1332 | } |
|
| 1333 | ||
| 1334 | return true; |
|
| 1335 | } |
|
| 1336 | ||
| 1337 | /** |
|
| 1338 | * Dispatches the model.created event. |
|
| @@ 1342-1355 (lines=14) @@ | ||
| 1339 | * |
|
| 1340 | * @return bool |
|
| 1341 | */ |
|
| 1342 | private function afterCreate() |
|
| 1343 | { |
|
| 1344 | $event = $this->dispatch(ModelEvent::CREATED); |
|
| 1345 | if ($event->isPropagationStopped()) { |
|
| 1346 | return false; |
|
| 1347 | } |
|
| 1348 | ||
| 1349 | // TODO deprecated |
|
| 1350 | if (method_exists($this, 'postCreateHook') && $this->postCreateHook() === false) { |
|
| 1351 | return false; |
|
| 1352 | } |
|
| 1353 | ||
| 1354 | return true; |
|
| 1355 | } |
|
| 1356 | ||
| 1357 | /** |
|
| 1358 | * Dispatches the model.updating event. |
|
| @@ 1364-1377 (lines=14) @@ | ||
| 1361 | * |
|
| 1362 | * @return bool |
|
| 1363 | */ |
|
| 1364 | private function beforeUpdate(array &$data) |
|
| 1365 | { |
|
| 1366 | $event = $this->dispatch(ModelEvent::UPDATING); |
|
| 1367 | if ($event->isPropagationStopped()) { |
|
| 1368 | return false; |
|
| 1369 | } |
|
| 1370 | ||
| 1371 | // TODO deprecated |
|
| 1372 | if (method_exists($this, 'preSetHook') && !$this->preSetHook($data)) { |
|
| 1373 | return false; |
|
| 1374 | } |
|
| 1375 | ||
| 1376 | return true; |
|
| 1377 | } |
|
| 1378 | ||
| 1379 | /** |
|
| 1380 | * Dispatches the model.updated event. |
|
| @@ 1384-1397 (lines=14) @@ | ||
| 1381 | * |
|
| 1382 | * @return bool |
|
| 1383 | */ |
|
| 1384 | private function afterUpdate() |
|
| 1385 | { |
|
| 1386 | $event = $this->dispatch(ModelEvent::UPDATED); |
|
| 1387 | if ($event->isPropagationStopped()) { |
|
| 1388 | return false; |
|
| 1389 | } |
|
| 1390 | ||
| 1391 | // TODO deprecated |
|
| 1392 | if (method_exists($this, 'postSetHook') && $this->postSetHook() === false) { |
|
| 1393 | return false; |
|
| 1394 | } |
|
| 1395 | ||
| 1396 | return true; |
|
| 1397 | } |
|
| 1398 | ||
| 1399 | /** |
|
| 1400 | * Dispatches the model.deleting event. |
|
| @@ 1404-1417 (lines=14) @@ | ||
| 1401 | * |
|
| 1402 | * @return bool |
|
| 1403 | */ |
|
| 1404 | private function beforeDelete() |
|
| 1405 | { |
|
| 1406 | $event = $this->dispatch(ModelEvent::DELETING); |
|
| 1407 | if ($event->isPropagationStopped()) { |
|
| 1408 | return false; |
|
| 1409 | } |
|
| 1410 | ||
| 1411 | // TODO deprecated |
|
| 1412 | if (method_exists($this, 'preDeleteHook') && !$this->preDeleteHook()) { |
|
| 1413 | return false; |
|
| 1414 | } |
|
| 1415 | ||
| 1416 | return true; |
|
| 1417 | } |
|
| 1418 | ||
| 1419 | /** |
|
| 1420 | * Dispatches the model.created event. |
|
| @@ 1424-1437 (lines=14) @@ | ||
| 1421 | * |
|
| 1422 | * @return bool |
|
| 1423 | */ |
|
| 1424 | private function afterDelete() |
|
| 1425 | { |
|
| 1426 | $event = $this->dispatch(ModelEvent::DELETED); |
|
| 1427 | if ($event->isPropagationStopped()) { |
|
| 1428 | return false; |
|
| 1429 | } |
|
| 1430 | ||
| 1431 | // TODO deprecated |
|
| 1432 | if (method_exists($this, 'postDeleteHook') && $this->postDeleteHook() === false) { |
|
| 1433 | return false; |
|
| 1434 | } |
|
| 1435 | ||
| 1436 | return true; |
|
| 1437 | } |
|
| 1438 | ||
| 1439 | ///////////////////////////// |
|
| 1440 | // Validation |
|