mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-01 23:29:45 +00:00
Changing Tree behavior's function names to be camel cased as per convention
This commit is contained in:
parent
43127caad2
commit
91b0a4ba4f
2 changed files with 11 additions and 11 deletions
cake
|
@ -204,7 +204,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* @return integer number of child nodes
|
* @return integer number of child nodes
|
||||||
* @link http://book.cakephp.org/view/1347/Counting-children
|
* @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)) {
|
if (is_array($id)) {
|
||||||
extract (array_merge(array('id' => null), $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
|
* @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
|
* @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;
|
$overrideRecursive = $recursive;
|
||||||
extract($this->settings[$Model->alias]);
|
extract($this->settings[$Model->alias]);
|
||||||
if (!is_null($overrideRecursive)) {
|
if (!is_null($overrideRecursive)) {
|
||||||
|
@ -362,7 +362,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* @return array Array of data for the parent node
|
* @return array Array of data for the parent node
|
||||||
* @link http://book.cakephp.org/view/1349/getparentnode
|
* @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)) {
|
if (is_array($id)) {
|
||||||
extract (array_merge(array('id' => null), $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
|
* @return array Array of nodes from top most parent to current node
|
||||||
* @link http://book.cakephp.org/view/1350/getpath
|
* @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)) {
|
if (is_array($id)) {
|
||||||
extract (array_merge(array('id' => null), $id));
|
extract (array_merge(array('id' => null), $id));
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* @return boolean true on success, false on failure
|
* @return boolean true on success, false on failure
|
||||||
* @link http://book.cakephp.org/view/1352/moveDown
|
* @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)) {
|
if (is_array($id)) {
|
||||||
extract (array_merge(array('id' => null), $id));
|
extract (array_merge(array('id' => null), $id));
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* @return boolean true on success, false on failure
|
* @return boolean true on success, false on failure
|
||||||
* @link http://book.cakephp.org/view/1353/moveUp
|
* @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)) {
|
if (is_array($id)) {
|
||||||
extract (array_merge(array('id' => null), $id));
|
extract (array_merge(array('id' => null), $id));
|
||||||
}
|
}
|
||||||
|
@ -601,7 +601,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
} else {
|
} else {
|
||||||
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
|
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
|
||||||
foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey, $parent), 'order' => $left)) as $array) {
|
foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey, $parent), 'order' => $left)) as $array) {
|
||||||
$path = $this->getpath($Model, $array[$Model->alias][$Model->primaryKey]);
|
$path = $this->getPath($Model, $array[$Model->alias][$Model->primaryKey]);
|
||||||
if ($path == null || count($path) < 2) {
|
if ($path == null || count($path) < 2) {
|
||||||
$parentId = null;
|
$parentId = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -673,7 +673,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* @return boolean true on success, false on failure
|
* @return boolean true on success, false on failure
|
||||||
* @link http://book.cakephp.org/view/1354/removeFromTree
|
* @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)) {
|
if (is_array($id)) {
|
||||||
extract (array_merge(array('id' => null), $id));
|
extract (array_merge(array('id' => null), $id));
|
||||||
}
|
}
|
||||||
|
|
|
@ -858,7 +858,7 @@ class NumberTreeTest extends CakeTestCase {
|
||||||
$result = $this->Tree->verify();
|
$result = $this->Tree->verify();
|
||||||
$this->assertIdentical($result, true);
|
$this->assertIdentical($result, true);
|
||||||
|
|
||||||
$this->Tree->moveup();
|
$this->Tree->moveUp();
|
||||||
|
|
||||||
$result = $this->Tree->find('all', array('fields' => 'name', 'order' => $modelClass . '.' . $leftField . ' ASC'));
|
$result = $this->Tree->find('all', array('fields' => 'name', 'order' => $modelClass . '.' . $leftField . ' ASC'));
|
||||||
$expected = array(array($modelClass => array('name' => '1.1')),
|
$expected = array(array($modelClass => array('name' => '1.1')),
|
||||||
|
@ -1132,7 +1132,7 @@ class NumberTreeTest extends CakeTestCase {
|
||||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.2.2'));
|
$data = $this->Tree->find(array($modelClass . '.name' => '1.2.2'));
|
||||||
$this->Tree->id= $data[$modelClass]['id'];
|
$this->Tree->id= $data[$modelClass]['id'];
|
||||||
|
|
||||||
$result = $this->Tree->getparentNode(null, array('name'));
|
$result = $this->Tree->getParentNode(null, array('name'));
|
||||||
$expects = array($modelClass => array('name' => '1.2'));
|
$expects = array($modelClass => array('name' => '1.2'));
|
||||||
$this->assertIdentical($result, $expects);
|
$this->assertIdentical($result, $expects);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue