Skip to content
Permalink
Browse files

Improve / fix docblock info regarding model callbacks.

  • Loading branch information...
ADmad committed Sep 5, 2014
1 parent a2b1d4a commit 23f3aecd45eae5113cd7d2fb72d9b9db26c8f392
Showing with 44 additions and 28 deletions.
  1. +17 −15 src/ORM/Behavior.php
  2. +27 −13 src/ORM/Table.php
@@ -14,8 +14,8 @@
*/
namespace Cake\ORM;
use Cake\Core\InstanceConfigTrait;
use Cake\Core\Exception\Exception;
use Cake\Core\InstanceConfigTrait;
use Cake\Event\EventListener;
/**
@@ -46,24 +46,26 @@
* CakePHP provides a number of lifecycle events your behaviors can
* listen to:
*
* - `beforeFind(Event $event, Query $query)`
* Fired before a query is converted into SQL.
* - `beforeFind(Event $event, Query $query, ArrayObject $options, boolean $primary)`
* Fired before each find operation. By stopping the event and supplying a
* return value you can bypass the find operation entirely. Any changes done
* to the $query instance will be retained for the rest of the find. The
* $primary parameter indicates whether or not this is the root query,
* or an associated query.
*
* - `beforeDelete(Event $event, Entity $entity)`
* Fired before an entity is deleted.
* - `beforeSave(Event $event, Entity $entity, ArrayObject $options)`
* Fired before each entity is saved. Stopping this event will abort the save
* operation. When the event is stopped the result of the event will be returned.
*
* - `afterDelete(Event $event, Entity $entity)`
* Fired after an entity has been deleted. The entity parameter
* will contain the entity state from before it was deleted.
* - `afterSave(Event $event, Entity $entity, ArrayObject $options)`
* Fired after an entity is saved.
*
* - `beforeSave(Event $event, Entity $entity)`
* Fired before an entity is saved. In the case where
* multiple entities are being saved, one event will be fired
* for each entity.
* - `beforeDelete(Event $event, Entity $entity, ArrayObject $options)`
* Fired before an entity is deleted. By stopping this event you will abort
* the delete operation.
*
* - `afterSave(Event $event, Entity $entity)`
* Fired after an entity is saved. The saved entity will be provided
* as a parameter.
* - `afterDelete(Event $event, Entity $entity, ArrayObject $options)`
* Fired after an entity has been deleted.
*
* In addition to the core events, behaviors can respond to any
* event fired from your Table classes including custom application
@@ -75,19 +75,33 @@
* Table objects provide a few callbacks/events you can hook into to augment/replace
* find operations. Each event uses the standard event subsystem in CakePHP
*
* - `beforeFind($event, $query, $options, $eagerLoaded)` - Fired before each find operation.
* By stopping the event and supplying a return value you can bypass the find operation
* entirely. Any changes done to the $query instance will be retained for the rest of the find.
* - `beforeValidate($event, $entity, $options, $validator)` - Fired before an entity is validated.
* By stopping this event, you can abort the validate + save operations.
* - `afterValidate($event, $entity, $options, $validator)` - Fired after an entity is validated.
* - `beforeSave($event, $entity, $options)` - Fired before each entity is saved. Stopping this
* event will abort the save operation. When the event is stopped the result of the event will
* be returned.
* - `afterSave($event, $entity, $options)` - Fired after an entity is saved.
* - `beforeDelete($event, $entity, $options)` - Fired before an entity is deleted.
* By stopping this event you will abort the delete operation.
* - `afterDelete($event, $entity, $options)` - Fired after an entity has been deleted.
* - `beforeFind(Event $event, Query $query, ArrayObject $options, boolean $primary)`
* Fired before each find operation. By stopping the event and supplying a
* return value you can bypass the find operation entirely. Any changes done
* to the $query instance will be retained for the rest of the find. The
* $primary parameter indicates whether or not this is the root query,
* or an associated query.
*
* - `beforeValidate(Event $event, Entity $entity, ArrayObject $options, Validator $validator)`
* Fired before an entity is validated. By stopping this event, you can abort
* the validate + save operations.
*
* - `afterValidate(Event $event, Entity $entity, ArrayObject $options, Validator $validator)`
* Fired after an entity is validated.
*
* - `beforeSave(Event $event, Entity $entity, ArrayObject $options)`
* Fired before each entity is saved. Stopping this event will abort the save
* operation. When the event is stopped the result of the event will be returned.
*
* - `afterSave(Event $event, Entity $entity, ArrayObject $options)`
* Fired after an entity is saved.
*
* - `beforeDelete(Event $event, Entity $entity, ArrayObject $options)`
* Fired before an entity is deleted. By stopping this event you will abort
* the delete operation.
*
* - `afterDelete(Event $event, Entity $entity, ArrayObject $options)`
* Fired after an entity has been deleted.
*
* @see \Cake\Event\EventManager for reference on the events system.
*/

0 comments on commit 23f3aec

Please sign in to comment.
You can’t perform that action at this time.