Skip to content

Commit

Permalink
Fixing strict warnings in TreeBehavior and a few other classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 12, 2010
1 parent b135e38 commit 33b8a35
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
34 changes: 17 additions & 17 deletions cake/libs/model/behaviors/tree.php
Expand Up @@ -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);
}
Expand All @@ -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]) {
Expand All @@ -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];
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/model/model_write.test.php
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/model/models.php
Expand Up @@ -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;
}
Expand Down

0 comments on commit 33b8a35

Please sign in to comment.