Revert "(mvc) remove unused getFlatNodes"

This reverts commit 6c6b861e778704d2aa2d06b569a1e3071f065465.
This commit is contained in:
Ad Schellevis 2016-08-08 17:31:03 +02:00
parent 6c6b861e77
commit 5bbced8090
2 changed files with 30 additions and 0 deletions

View File

@ -259,6 +259,15 @@ abstract class BaseModel
$this->internalData->$name = $value ;
}
/**
* forward to root node's getFlatNodes
* @return array all children
*/
public function getFlatNodes()
{
return $this->internalData->getFlatNodes();
}
/**
* get nodes as array structure
* @return array

View File

@ -388,6 +388,27 @@ abstract class BaseField
return $this->internalXMLTagName;
}
/**
* Recursive method to flatten tree structure for easy validation, returns only leaf nodes.
* @return array named array with field type nodes, using the internal reference.
*/
public function getFlatNodes()
{
$result = array ();
if (count($this->internalChildnodes) == 0) {
return array($this);
}
foreach ($this->__items as $node) {
foreach ($node->getFlatNodes() as $childNode) {
$result[$childNode->internalReference] = $childNode ;
}
}
return $result;
}
/**
* get nodes as array structure
* @return array