Commit 5bbced80 authored by Ad Schellevis's avatar Ad Schellevis

Revert "(mvc) remove unused getFlatNodes"

This reverts commit 6c6b861e.
parent 6c6b861e
...@@ -259,6 +259,15 @@ abstract class BaseModel ...@@ -259,6 +259,15 @@ abstract class BaseModel
$this->internalData->$name = $value ; $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 * get nodes as array structure
* @return array * @return array
......
...@@ -388,6 +388,27 @@ abstract class BaseField ...@@ -388,6 +388,27 @@ abstract class BaseField
return $this->internalXMLTagName; 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 * get nodes as array structure
* @return array * @return array
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment