Skip to content
Permalink
Browse files

Update afterFind() callback signature to be PHP5.4+ compliant.

  • Loading branch information...
bar committed Sep 10, 2013
1 parent 994a5b0 commit 0a52061d860bc67fd8f642cf3cc2bd9382093b4f
@@ -275,7 +275,7 @@ protected function _addJoin(Model $Model, $query, $field, $aliasField, $locale)
* @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);
@@ -3392,12 +3392,12 @@ public function joinModel($assoc, $keys = array()) {
* 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;
}
@@ -132,7 +132,7 @@ public function beforeFind(Model $model, $query) {
* @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) {
}
/**
@@ -84,7 +84,7 @@ public function beforeFind(Model $model, $query) {
* @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);

0 comments on commit 0a52061

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