public function findByParentAndNodeType($parentPath, $nodeTypeFilter, Workspace $workspace, array $dimensions = null, $removedNodes = false, $recursive = false)
{
$parentPath = strtolower($parentPath);
$foundNodes = $this->getNodeDataForParentAndNodeType($parentPath, $nodeTypeFilter, $workspace, $dimensions, $removedNodes, $recursive);
$childNodeDepth = NodePaths::getPathDepth($parentPath) + 1;
$constraints = $nodeTypeFilter !== '' ? $this->getNodeTypeFilterConstraintsForDql($nodeTypeFilter) : array();
/** @var $addedNode NodeData */
foreach ($this->addedNodes as $addedNode) {
if (($recursive && $addedNode->getDepth() >= $childNodeDepth || $addedNode->getDepth() === $childNodeDepth) && ($recursive && NodePaths::isSubPathOf($addedNode->getPath(), $parentPath) || NodePaths::getParentPath($addedNode->getPath()) === $parentPath) && $addedNode->matchesWorkspaceAndDimensions($workspace, $dimensions)) {
$nodeType = $addedNode->getNodeType();
$disallowed = false;
foreach ($constraints['includeNodeTypes'] as $includeNodeType) {
if (!$nodeType->isOfType($includeNodeType)) {
$disallowed = true;
}
}
foreach ($constraints['excludeNodeTypes'] as $excludeNodeTypes) {
if ($nodeType->isOfType($excludeNodeTypes)) {
$disallowed = true;
}
}
if ($disallowed === false) {
$foundNodes[$addedNode->getIdentifier()] = $addedNode;
}
}
}
/** @var $removedNode NodeData */
foreach ($this->removedNodes as $removedNode) {
if (($recursive && $removedNode->getDepth() >= $childNodeDepth || $removedNode->getDepth() === $childNodeDepth) && ($recursive && NodePaths::isSubPathOf($removedNode->getPath(), $parentPath) || NodePaths::getParentPath($removedNode->getPath()) === $parentPath) && $removedNode->matchesWorkspaceAndDimensions($workspace, $dimensions)) {
if (isset($foundNodes[$removedNode->getIdentifier()])) {
unset($foundNodes[$removedNode->getIdentifier()]);
}
}
}
$foundNodes = $this->sortNodesByIndex($foundNodes);
return $foundNodes;
}