| @@ 1351-1364 (lines=14) @@ | ||
| 1348 | * |
|
| 1349 | * @return bool |
|
| 1350 | */ |
|
| 1351 | private function beforeCreate() |
|
| 1352 | { |
|
| 1353 | $event = $this->dispatch(ModelEvent::CREATING); |
|
| 1354 | if ($event->isPropagationStopped()) { |
|
| 1355 | return false; |
|
| 1356 | } |
|
| 1357 | ||
| 1358 | // TODO deprecated |
|
| 1359 | if (method_exists($this, 'preCreateHook') && !$this->preCreateHook($this->_unsaved)) { |
|
| 1360 | return false; |
|
| 1361 | } |
|
| 1362 | ||
| 1363 | return true; |
|
| 1364 | } |
|
| 1365 | ||
| 1366 | /** |
|
| 1367 | * Dispatches the model.created event. |
|
| @@ 1371-1384 (lines=14) @@ | ||
| 1368 | * |
|
| 1369 | * @return bool |
|
| 1370 | */ |
|
| 1371 | private function afterCreate() |
|
| 1372 | { |
|
| 1373 | $event = $this->dispatch(ModelEvent::CREATED); |
|
| 1374 | if ($event->isPropagationStopped()) { |
|
| 1375 | return false; |
|
| 1376 | } |
|
| 1377 | ||
| 1378 | // TODO deprecated |
|
| 1379 | if (method_exists($this, 'postCreateHook') && $this->postCreateHook() === false) { |
|
| 1380 | return false; |
|
| 1381 | } |
|
| 1382 | ||
| 1383 | return true; |
|
| 1384 | } |
|
| 1385 | ||
| 1386 | /** |
|
| 1387 | * Dispatches the model.updating event. |
|
| @@ 1393-1406 (lines=14) @@ | ||
| 1390 | * |
|
| 1391 | * @return bool |
|
| 1392 | */ |
|
| 1393 | private function beforeUpdate(array &$data) |
|
| 1394 | { |
|
| 1395 | $event = $this->dispatch(ModelEvent::UPDATING); |
|
| 1396 | if ($event->isPropagationStopped()) { |
|
| 1397 | return false; |
|
| 1398 | } |
|
| 1399 | ||
| 1400 | // TODO deprecated |
|
| 1401 | if (method_exists($this, 'preSetHook') && !$this->preSetHook($data)) { |
|
| 1402 | return false; |
|
| 1403 | } |
|
| 1404 | ||
| 1405 | return true; |
|
| 1406 | } |
|
| 1407 | ||
| 1408 | /** |
|
| 1409 | * Dispatches the model.updated event. |
|
| @@ 1413-1426 (lines=14) @@ | ||
| 1410 | * |
|
| 1411 | * @return bool |
|
| 1412 | */ |
|
| 1413 | private function afterUpdate() |
|
| 1414 | { |
|
| 1415 | $event = $this->dispatch(ModelEvent::UPDATED); |
|
| 1416 | if ($event->isPropagationStopped()) { |
|
| 1417 | return false; |
|
| 1418 | } |
|
| 1419 | ||
| 1420 | // TODO deprecated |
|
| 1421 | if (method_exists($this, 'postSetHook') && $this->postSetHook() === false) { |
|
| 1422 | return false; |
|
| 1423 | } |
|
| 1424 | ||
| 1425 | return true; |
|
| 1426 | } |
|
| 1427 | ||
| 1428 | /** |
|
| 1429 | * Dispatches the model.deleting event. |
|
| @@ 1433-1446 (lines=14) @@ | ||
| 1430 | * |
|
| 1431 | * @return bool |
|
| 1432 | */ |
|
| 1433 | private function beforeDelete() |
|
| 1434 | { |
|
| 1435 | $event = $this->dispatch(ModelEvent::DELETING); |
|
| 1436 | if ($event->isPropagationStopped()) { |
|
| 1437 | return false; |
|
| 1438 | } |
|
| 1439 | ||
| 1440 | // TODO deprecated |
|
| 1441 | if (method_exists($this, 'preDeleteHook') && !$this->preDeleteHook()) { |
|
| 1442 | return false; |
|
| 1443 | } |
|
| 1444 | ||
| 1445 | return true; |
|
| 1446 | } |
|
| 1447 | ||
| 1448 | /** |
|
| 1449 | * Dispatches the model.created event. |
|
| @@ 1453-1466 (lines=14) @@ | ||
| 1450 | * |
|
| 1451 | * @return bool |
|
| 1452 | */ |
|
| 1453 | private function afterDelete() |
|
| 1454 | { |
|
| 1455 | $event = $this->dispatch(ModelEvent::DELETED); |
|
| 1456 | if ($event->isPropagationStopped()) { |
|
| 1457 | return false; |
|
| 1458 | } |
|
| 1459 | ||
| 1460 | // TODO deprecated |
|
| 1461 | if (method_exists($this, 'postDeleteHook') && $this->postDeleteHook() === false) { |
|
| 1462 | return false; |
|
| 1463 | } |
|
| 1464 | ||
| 1465 | return true; |
|
| 1466 | } |
|
| 1467 | ||
| 1468 | ///////////////////////////// |
|
| 1469 | // Validation |
|