开发者

movedown method not saving new position - cakephp tree

开发者 https://www.devze.com 2023-02-04 09:42 出处:网络
I am experiencing a problem that has popped up recently and is causing quite a bit of trouble for our system.

I am experiencing a problem that has popped up recently and is causing quite a bit of trouble for our system.

The app we have relies on using the movedown method to organize content, but as of late it has stopped working and began to generate the following warning:

Warning (2): array_values() [<a href='function.array-values'>function.array-values</a>]: The argument should be an array in [/usr/local/h开发者_运维知识库ome/cake/cake_0_2_9/cake/libs/model/behaviors/tree.php, line 459]

The line being referenced:

list($node) = array_values($Model->find('first', array(
   'conditions' => array($scope, $Model->escapeField() => $id),
   'fields' => array($Model->primaryKey, $left, $right, $parent), 'recursive' => $recursive
  )));

The line calling the method:

$this->movedown($id,abs((int)$position));

I have exhausted every idea I could come up with. Has anyone else crossed this issue before?

Any help, or pointing in a direction would be much appreciated!


Simplify your problem

Configure::write('debug', 1); // <- turn on debug mode (if not set earlier)

$fields = array($Model->primaryKey, $left, $right, $parent), 'recursive' => $recursive));
$conditions = array($scope, $Model->escapeField() => $id);
$results = $Model->find('first', array(
   'conditions' => $conditions,
   'fields' => $fields)
);
$values = array_values($results);
list($node) = $values;

echo '<pre>'; 
debug($fields);
debug($conditions); 
debug($results);
debug($values); 
debug($node); 
exit;

Now you can see which variable is passed as undefined.

0

精彩评论

暂无评论...
验证码 换一张
取 消