mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-04 02:22:39 +00:00
Fixing strict warnings in TreeBehavior and a few other classes.
This commit is contained in:
parent
b135e38072
commit
33b8a35b75
3 changed files with 19 additions and 19 deletions
|
@ -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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* [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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @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;
|
||||
|
|
|
@ -3068,7 +3068,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
*/
|
||||
function testSaveAllNestedSaveAll() {
|
||||
$this->loadFixtures('Sample');
|
||||
$TransactionTestModel =& new TransactionTestModel();
|
||||
$TransactionTestModel = new TransactionTestModel();
|
||||
|
||||
$data = array(
|
||||
array('apple_id' => 1, 'name' => 'sample5'),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue