From 33b8a35b75f964da169619574b7c6483ea640a1c Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 12 Dec 2010 14:56:48 -0500 Subject: [PATCH] Fixing strict warnings in TreeBehavior and a few other classes. --- cake/libs/model/behaviors/tree.php | 34 +++++++++---------- .../cases/libs/model/model_write.test.php | 2 +- cake/tests/cases/libs/model/models.php | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cake/libs/model/behaviors/tree.php b/cake/libs/model/behaviors/tree.php index 991d4fd1a1c..9bec6f0ae1e 100644 --- a/cake/libs/model/behaviors/tree.php +++ b/cake/libs/model/behaviors/tree.php @@ -57,7 +57,7 @@ class TreeBehavior extends ModelBehavior { * @param array $config array of configuration settings. * @return void */ - public function setup(&$Model, $config = array()) { + public function setup($Model, $config = array()) { if (!is_array($config)) { $config = array('type' => $config); } @@ -82,7 +82,7 @@ public function setup(&$Model, $config = array()) { * @param boolean $created indicates whether the node just saved was created or updated * @return boolean true on success, false on failure */ - public function afterSave(&$Model, $created) { + public function afterSave($Model, $created) { extract($this->settings[$Model->alias]); if ($created) { if ((isset($Model->data[$Model->alias][$parent])) && $Model->data[$Model->alias][$parent]) { @@ -102,7 +102,7 @@ public function afterSave(&$Model, $created) { * @param AppModel $Model Model instance * @return boolean true to continue, false to abort the delete */ - public function beforeDelete(&$Model) { + public function beforeDelete($Model, $cascade = true) { extract($this->settings[$Model->alias]); list($name, $data) = array($Model->alias, $Model->read()); $data = $data[$name]; @@ -134,7 +134,7 @@ public function beforeDelete(&$Model) { * @param AppModel $Model Model instance * @return boolean true to continue, false to abort the save */ - public function beforeSave(&$Model) { + public function beforeSave($Model) { extract($this->settings[$Model->alias]); $this->_addToWhitelist($Model, array($left, $right)); @@ -204,7 +204,7 @@ public function beforeSave(&$Model) { * @return integer number of child nodes * @link http://book.cakephp.org/view/1347/Counting-children */ - public function childCount(&$Model, $id = null, $direct = false) { + public function childCount($Model, $id = null, $direct = false) { if (is_array($id)) { extract (array_merge(array('id' => null), $id)); } @@ -250,7 +250,7 @@ public function childCount(&$Model, $id = null, $direct = false) { * @return array Array of child nodes * @link http://book.cakephp.org/view/1346/Children */ - public function children(&$Model, $id = null, $direct = false, $fields = null, $order = null, $limit = null, $page = 1, $recursive = null) { + public function children($Model, $id = null, $direct = false, $fields = null, $order = null, $limit = null, $page = 1, $recursive = null) { if (is_array($id)) { extract (array_merge(array('id' => null), $id)); } @@ -307,7 +307,7 @@ public function children(&$Model, $id = null, $direct = false, $fields = null, $ * @return array An associative array of records, where the id is the key, and the display field is the value * @link http://book.cakephp.org/view/1348/generatetreelist */ - public function generateTreeList(&$Model, $conditions = null, $keyPath = null, $valuePath = null, $spacer = '_', $recursive = null) { + public function generateTreeList($Model, $conditions = null, $keyPath = null, $valuePath = null, $spacer = '_', $recursive = null) { $overrideRecursive = $recursive; extract($this->settings[$Model->alias]); if (!is_null($overrideRecursive)) { @@ -362,7 +362,7 @@ public function generateTreeList(&$Model, $conditions = null, $keyPath = null, $ * @return array Array of data for the parent node * @link http://book.cakephp.org/view/1349/getparentnode */ - public function getParentNode(&$Model, $id = null, $fields = null, $recursive = null) { + public function getParentNode($Model, $id = null, $fields = null, $recursive = null) { if (is_array($id)) { extract (array_merge(array('id' => null), $id)); } @@ -395,7 +395,7 @@ public function getParentNode(&$Model, $id = null, $fields = null, $recursive = * @return array Array of nodes from top most parent to current node * @link http://book.cakephp.org/view/1350/getpath */ - public function getPath(&$Model, $id = null, $fields = null, $recursive = null) { + public function getPath($Model, $id = null, $fields = null, $recursive = null) { if (is_array($id)) { extract (array_merge(array('id' => null), $id)); } @@ -432,7 +432,7 @@ public function getPath(&$Model, $id = null, $fields = null, $recursive = null) * @return boolean true on success, false on failure * @link http://book.cakephp.org/view/1352/moveDown */ - public function moveDown(&$Model, $id = null, $number = 1) { + public function moveDown($Model, $id = null, $number = 1) { if (is_array($id)) { extract (array_merge(array('id' => null), $id)); } @@ -490,7 +490,7 @@ public function moveDown(&$Model, $id = null, $number = 1) { * @return boolean true on success, false on failure * @link http://book.cakephp.org/view/1353/moveUp */ - public function moveUp(&$Model, $id = null, $number = 1) { + public function moveUp($Model, $id = null, $number = 1) { if (is_array($id)) { extract (array_merge(array('id' => null), $id)); } @@ -554,7 +554,7 @@ public function moveUp(&$Model, $id = null, $number = 1) { * @return boolean true on success, false on failure * @link http://book.cakephp.org/view/1628/Recover */ - public function recover(&$Model, $mode = 'parent', $missingParentAction = null) { + public function recover($Model, $mode = 'parent', $missingParentAction = null) { if (is_array($mode)) { extract (array_merge(array('mode' => 'parent'), $mode)); } @@ -634,7 +634,7 @@ public function recover(&$Model, $mode = 'parent', $missingParentAction = null) * @link http://book.cakephp.org/view/1355/reorder * @link http://book.cakephp.org/view/1629/Reorder */ - function reorder(&$Model, $options = array()) { + function reorder($Model, $options = array()) { $options = array_merge(array('id' => null, 'field' => $Model->displayField, 'order' => 'ASC', 'verify' => true), $options); extract($options); if ($verify && !$this->verify($Model)) { @@ -673,7 +673,7 @@ function reorder(&$Model, $options = array()) { * @return boolean true on success, false on failure * @link http://book.cakephp.org/view/1354/removeFromTree */ - public function removeFromTree(&$Model, $id = null, $delete = false) { + public function removeFromTree($Model, $id = null, $delete = false) { if (is_array($id)) { extract (array_merge(array('id' => null), $id)); } @@ -744,7 +744,7 @@ public function removeFromTree(&$Model, $id = null, $delete = false) { * [incorrect left/right index,node id], message) * @link http://book.cakephp.org/view/1630/Verify */ - public function verify(&$Model) { + public function verify($Model) { extract($this->settings[$Model->alias]); if (!$Model->find('count', array('conditions' => $scope))) { return true; @@ -815,7 +815,7 @@ public function verify(&$Model) { * @param mixed $parentId * @return boolean true on success, false on failure */ - protected function _setParent(&$Model, $parentId = null, $created = false) { + protected function _setParent($Model, $parentId = null, $created = false) { extract($this->settings[$Model->alias]); list($node) = array_values($Model->find('first', array( 'conditions' => array($scope, $Model->escapeField() => $Model->id), @@ -938,7 +938,7 @@ function __getMin($Model, $scope, $left, $recursive = -1) { * @param string $field * @access private */ - function __sync(&$Model, $shift, $dir = '+', $conditions = array(), $created = false, $field = 'both') { + function __sync($Model, $shift, $dir = '+', $conditions = array(), $created = false, $field = 'both') { $ModelRecursive = $Model->recursive; extract($this->settings[$Model->alias]); $Model->recursive = $recursive; diff --git a/cake/tests/cases/libs/model/model_write.test.php b/cake/tests/cases/libs/model/model_write.test.php index 4cac5959eef..c726ea47f67 100644 --- a/cake/tests/cases/libs/model/model_write.test.php +++ b/cake/tests/cases/libs/model/model_write.test.php @@ -3068,7 +3068,7 @@ function testSaveAllAssociatedTransactionNoRollback() { */ function testSaveAllNestedSaveAll() { $this->loadFixtures('Sample'); - $TransactionTestModel =& new TransactionTestModel(); + $TransactionTestModel = new TransactionTestModel(); $data = array( array('apple_id' => 1, 'name' => 'sample5'), diff --git a/cake/tests/cases/libs/model/models.php b/cake/tests/cases/libs/model/models.php index 45e3fc80c93..6b84ed2f0ea 100644 --- a/cake/tests/cases/libs/model/models.php +++ b/cake/tests/cases/libs/model/models.php @@ -293,7 +293,7 @@ class BeforeDeleteComment extends CakeTestModel { var $useTable = 'comments'; function beforeDelete($cascade = true) { - $db =& $this->getDataSource(); + $db = $this->getDataSource(); $db->delete($this, array($this->alias . '.' . $this->primaryKey => array(1, 3))); return true; }