Merge pull request #1623 from bar/php54-afterFind

Update afterFind() callback signature to be PHP5.4+ compliant.
This commit is contained in:
ADmad 2013-09-10 11:55:07 -07:00
commit e77a75147f
4 changed files with 6 additions and 6 deletions

View file

@ -275,7 +275,7 @@ class TranslateBehavior extends ModelBehavior {
* @param boolean $primary Did the find originate on $model.
* @return array Modified results
*/
public function afterFind(Model $Model, $results, $primary) {
public function afterFind(Model $Model, $results, $primary = false) {
$Model->virtualFields = $this->runtime[$Model->alias]['virtualFields'];
$this->runtime[$Model->alias]['virtualFields'] = $this->runtime[$Model->alias]['fields'] = array();
$locale = $this->_getLocale($Model);

View file

@ -3392,12 +3392,12 @@ class Model extends Object implements CakeEventListener {
* Called before each find operation. Return false if you want to halt the find
* call, otherwise return the (modified) query data.
*
* @param array $queryData Data used to execute this query, i.e. conditions, order, etc.
* @param array $query Data used to execute this query, i.e. conditions, order, etc.
* @return mixed true if the operation should continue, false if it should abort; or, modified
* $queryData to continue with new $queryData
* $query to continue with new $query
* @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforefind
*/
public function beforeFind($queryData) {
public function beforeFind($query) {
return true;
}

View file

@ -132,7 +132,7 @@ class ModelBehavior extends Object {
* @param boolean $primary Whether this model is being queried directly (vs. being queried as an association)
* @return mixed An array value will replace the value of $results - any other value will be ignored.
*/
public function afterFind(Model $model, $results, $primary) {
public function afterFind(Model $model, $results, $primary = false) {
}
/**

View file

@ -84,7 +84,7 @@ class TestBehavior extends ModelBehavior {
* @param boolean $primary
* @return void
*/
public function afterFind(Model $model, $results, $primary) {
public function afterFind(Model $model, $results, $primary = false) {
$settings = $this->settings[$model->alias];
if (!isset($settings['afterFind']) || $settings['afterFind'] === 'off') {
return parent::afterFind($model, $results, $primary);