作者:radmiraa
项目:TYPO3.TYPO3C
public function setUp()
{
$this->mockWorkspace = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace', array(), array(), '', FALSE);
$this->mockNodeType = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeType', array(), array(), '', FALSE);
$this->mockNodeTypeManager = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Service\\NodeTypeManager', array(), array(), '', FALSE);
$this->mockNodeTypeManager->expects($this->any())->method('getNodeType')->will($this->returnValue($this->mockNodeType));
$this->nodeData = $this->getAccessibleMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData', array('dummy'), array('/foo/bar', $this->mockWorkspace));
$this->nodeData->_set('nodeTypeManager', $this->mockNodeTypeManager);
$this->nodeData->_set('nodeDataRepository', $this->getMock('TYPO3\\Flow\\Persistence\\RepositoryInterface'));
}
作者:robertlemk
项目:neos-development-collectio
public function setUp()
{
$this->mockWorkspace = $this->getMockBuilder(Workspace::class)->disableOriginalConstructor()->getMock();
$this->nodeData = $this->getAccessibleMock(NodeData::class, array('addOrUpdate'), array('/foo/bar', $this->mockWorkspace));
$this->mockNodeType = $this->getMockBuilder(NodeType::class)->disableOriginalConstructor()->getMock();
$this->mockNodeTypeManager = $this->getMockBuilder(NodeTypeManager::class)->disableOriginalConstructor()->getMock();
$this->mockNodeTypeManager->expects($this->any())->method('getNodeType')->will($this->returnValue($this->mockNodeType));
$this->mockNodeTypeManager->expects($this->any())->method('hasNodeType')->will($this->returnValue(true));
$this->inject($this->nodeData, 'nodeTypeManager', $this->mockNodeTypeManager);
$this->mockNodeDataRepository = $this->getMockBuilder(NodeDataRepository::class)->disableOriginalConstructor()->getMock();
$this->inject($this->nodeData, 'nodeDataRepository', $this->mockNodeDataRepository);
}
作者:hhoecht
项目:neos-development-collectio
public function setUp()
{
$this->mockWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
$this->nodeData = $this->getAccessibleMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData', array('addOrUpdate'), array('/foo/bar', $this->mockWorkspace));
$this->mockNodeType = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeType')->disableOriginalConstructor()->getMock();
$this->mockNodeTypeManager = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\NodeTypeManager')->disableOriginalConstructor()->getMock();
$this->mockNodeTypeManager->expects($this->any())->method('getNodeType')->will($this->returnValue($this->mockNodeType));
$this->mockNodeTypeManager->expects($this->any())->method('hasNodeType')->will($this->returnValue(true));
$this->inject($this->nodeData, 'nodeTypeManager', $this->mockNodeTypeManager);
$this->mockNodeDataRepository = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Repository\\NodeDataRepository')->disableOriginalConstructor()->getMock();
$this->inject($this->nodeData, 'nodeDataRepository', $this->mockNodeDataRepository);
}
作者:testbir
项目:neos-development-collectio
/**
* @test
* @expectedException \TYPO3\TYPO3CR\Exception\NodeTypeIsFinalException
*/
public function getNodeTypeThrowsExceptionIfFinalNodeTypeIsSubclassed()
{
$this->nodeTypeManager = new NodeTypeManager();
$nodeTypesFixture = array('TYPO3.TYPO3CR.Testing:Base' => array('final' => true), 'TYPO3.TYPO3CR.Testing:Sub' => array('superTypes' => array('TYPO3.TYPO3CR.Testing:Base' => true)));
$mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock();
$mockConfigurationManager->expects($this->atLeastOnce())->method('getConfiguration')->with('NodeTypes')->will($this->returnValue($nodeTypesFixture));
$this->inject($this->nodeTypeManager, 'configurationManager', $mockConfigurationManager);
$this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:Sub');
}
作者:hlube
项目:neos-development-collectio
/**
* Repair inconsistent nodes
*
* This command analyzes and repairs the node tree structure and individual nodes
* based on the current node type configuration.
*
* The following checks will be performed:
*
* {pluginDescriptions}
* <b>Examples:</b>
*
* ./flow node:repair
*
* ./flow node:repair --node-type TYPO3.Neos.NodeTypes:Page
*
* @param string $nodeType Node type name, if empty update all declared node types
* @param string $workspace Workspace name, default is 'live'
* @param boolean $dryRun Don't do anything, but report actions
* @param boolean $cleanup If FALSE, cleanup tasks are skipped
* @return void
*/
public function repairCommand($nodeType = null, $workspace = 'live', $dryRun = false, $cleanup = true)
{
$this->pluginConfigurations = self::detectPlugins($this->objectManager);
if ($this->workspaceRepository->countByName($workspace) === 0) {
$this->outputLine('Workspace "%s" does not exist', array($workspace));
exit(1);
}
if ($nodeType !== null) {
if ($this->nodeTypeManager->hasNodeType($nodeType)) {
$nodeType = $this->nodeTypeManager->getNodeType($nodeType);
} else {
$this->outputLine('Node type "%s" does not exist', array($nodeType));
exit(1);
}
}
if ($dryRun) {
$this->outputLine('Dry run, not committing any changes.');
}
foreach ($this->pluginConfigurations as $pluginConfiguration) {
/** @var NodeCommandControllerPluginInterface $plugin */
$plugin = $pluginConfiguration['object'];
$this->outputLine('<b>' . $plugin->getSubCommandShortDescription('repair') . '</b>');
$this->outputLine();
$plugin->invokeSubCommand('repair', $this->output, $nodeType, $workspace, $dryRun, $cleanup);
$this->outputLine();
}
$this->outputLine('Node repair finished.');
}
作者:skurfuers
项目:Flowpack.ElasticSearch.ContentRepositoryAdapto
/**
* Builds a Mapping Collection from the configured node types
*
* @param \Flowpack\ElasticSearch\Domain\Model\Index $index
* @return \Flowpack\ElasticSearch\Mapping\MappingCollection<\Flowpack\ElasticSearch\Domain\Model\Mapping>
*/
public function buildMappingInformation(Index $index)
{
$this->lastMappingErrors = new \TYPO3\Flow\Error\Result();
$mappings = new MappingCollection(MappingCollection::TYPE_ENTITY);
/** @var NodeType $nodeType */
foreach ($this->nodeTypeManager->getNodeTypes() as $nodeTypeName => $nodeType) {
if ($nodeTypeName === 'unstructured' || $nodeType->isAbstract()) {
continue;
}
$type = $index->findType(self::convertNodeTypeNameToMappingName($nodeTypeName));
$mapping = new Mapping($type);
// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-root-object-type.html#_dynamic_templates
// 'not_analyzed' is necessary
$mapping->addDynamicTemplate('dimensions', array('path_match' => '__dimensionCombinations.*', 'match_mapping_type' => 'string', 'mapping' => array('type' => 'string', 'index' => 'not_analyzed')));
foreach ($nodeType->getProperties() as $propertyName => $propertyConfiguration) {
if (isset($propertyConfiguration['search']) && isset($propertyConfiguration['search']['elasticSearchMapping'])) {
if (is_array($propertyConfiguration['search']['elasticSearchMapping'])) {
$mapping->setPropertyByPath($propertyName, $propertyConfiguration['search']['elasticSearchMapping']);
}
} elseif (isset($propertyConfiguration['type']) && isset($this->defaultConfigurationPerType[$propertyConfiguration['type']]['elasticSearchMapping'])) {
if (is_array($this->defaultConfigurationPerType[$propertyConfiguration['type']]['elasticSearchMapping'])) {
$mapping->setPropertyByPath($propertyName, $this->defaultConfigurationPerType[$propertyConfiguration['type']]['elasticSearchMapping']);
}
} else {
$this->lastMappingErrors->addWarning(new \TYPO3\Flow\Error\Warning('Node Type "' . $nodeTypeName . '" - property "' . $propertyName . '": No ElasticSearch Mapping found.'));
}
}
$mappings->add($mapping);
}
return $mappings;
}
作者:mgoldbec
项目:neos-development-collectio
/**
* Helper method for creating a new node.
*
* @param NodeInterface $referenceNode
* @param array $nodeData
* @param string $position
* @return NodeInterface
* @throws \InvalidArgumentException
*/
public function create(NodeInterface $referenceNode, array $nodeData, $position)
{
if (!in_array($position, array('before', 'into', 'after'), true)) {
throw new \InvalidArgumentException('The position should be one of the following: "before", "into", "after".', 1347133640);
}
$nodeType = $this->nodeTypeManager->getNodeType($nodeData['nodeType']);
if ($nodeType->isOfType('TYPO3.Neos:Document') && !isset($nodeData['properties']['uriPathSegment']) && isset($nodeData['properties']['title'])) {
$nodeData['properties']['uriPathSegment'] = Utility::renderValidNodeName($nodeData['properties']['title']);
}
$proposedNodeName = isset($nodeData['nodeName']) ? $nodeData['nodeName'] : null;
$nodeData['nodeName'] = $this->nodeService->generateUniqueNodeName($this->getDesignatedParentNode($referenceNode, $position)->getPath(), $proposedNodeName);
if ($position === 'into') {
$newNode = $referenceNode->createNode($nodeData['nodeName'], $nodeType);
} else {
$parentNode = $referenceNode->getParent();
$newNode = $parentNode->createNode($nodeData['nodeName'], $nodeType);
if ($position === 'before') {
$newNode->moveBefore($referenceNode);
} else {
$newNode->moveAfter($referenceNode);
}
}
if (isset($nodeData['properties']) && is_array($nodeData['properties'])) {
foreach ($nodeData['properties'] as $propertyName => $propertyValue) {
$newNode->setProperty($propertyName, $propertyValue);
}
}
return $newNode;
}
作者:christophlehman
项目:MOC.Varnis
/**
* @param string $searchWord
* @param Site $selectedSite
* @return void
*/
public function searchForNodeAction($searchWord, Site $selectedSite = NULL)
{
$documentNodeTypes = $this->nodeTypeManager->getSubNodeTypes('TYPO3.Neos:Document');
$shortcutNodeType = $this->nodeTypeManager->getNodeType('TYPO3.Neos:Shortcut');
$nodeTypes = array_diff($documentNodeTypes, array($shortcutNodeType));
$sites = array();
$activeSites = $this->siteRepository->findOnline();
foreach ($selectedSite ? array($selectedSite) : $activeSites as $site) {
/** @var Site $site */
$contextProperties = array('workspaceName' => 'live', 'currentSite' => $site);
$contentDimensionPresets = $this->contentDimensionPresetSource->getAllPresets();
if (count($contentDimensionPresets) > 0) {
$mergedContentDimensions = array();
foreach ($contentDimensionPresets as $contentDimensionIdentifier => $contentDimension) {
$mergedContentDimensions[$contentDimensionIdentifier] = array($contentDimension['default']);
foreach ($contentDimension['presets'] as $contentDimensionPreset) {
$mergedContentDimensions[$contentDimensionIdentifier] = array_merge($mergedContentDimensions[$contentDimensionIdentifier], $contentDimensionPreset['values']);
}
$mergedContentDimensions[$contentDimensionIdentifier] = array_values(array_unique($mergedContentDimensions[$contentDimensionIdentifier]));
}
$contextProperties['dimensions'] = $mergedContentDimensions;
}
/** @var ContentContext $liveContext */
$liveContext = $this->contextFactory->create($contextProperties);
$firstActiveDomain = $site->getFirstActiveDomain();
$nodes = $this->nodeSearchService->findByProperties($searchWord, $nodeTypes, $liveContext, $liveContext->getCurrentSiteNode());
if (count($nodes) > 0) {
$sites[$site->getNodeName()] = array('site' => $site, 'domain' => $firstActiveDomain ? $firstActiveDomain->getHostPattern() : $this->request->getHttpRequest()->getUri()->getHost(), 'nodes' => $nodes);
}
}
$this->view->assignMultiple(array('searchWord' => $searchWord, 'protocol' => $this->request->getHttpRequest()->getUri()->getScheme(), 'selectedSite' => $selectedSite, 'sites' => $sites, 'activeSites' => $activeSites));
}
作者:radmiraa
项目:neos-development-collectio
/**
* Returns the node types that the currently authenticated user is *denied* to create within the given $referenceNode
*
* @param NodeInterface $referenceNode
* @return string[] Array of granted node type names
*/
public function getNodeTypeNamesDeniedForCreation(NodeInterface $referenceNode)
{
$privilegeSubject = new CreateNodePrivilegeSubject($referenceNode);
$allNodeTypes = $this->nodeTypeManager->getNodeTypes();
$deniedCreationNodeTypes = array();
$grantedCreationNodeTypes = array();
$abstainedCreationNodeTypes = array();
foreach ($this->securityContext->getRoles() as $role) {
/** @var CreateNodePrivilege $createNodePrivilege */
foreach ($role->getPrivilegesByType(CreateNodePrivilege::class) as $createNodePrivilege) {
if (!$createNodePrivilege->matchesSubject($privilegeSubject)) {
continue;
}
$affectedNodeTypes = $createNodePrivilege->getCreationNodeTypes() !== array() ? $createNodePrivilege->getCreationNodeTypes() : $allNodeTypes;
if ($createNodePrivilege->isGranted()) {
$grantedCreationNodeTypes = array_merge($grantedCreationNodeTypes, $affectedNodeTypes);
} elseif ($createNodePrivilege->isDenied()) {
$deniedCreationNodeTypes = array_merge($deniedCreationNodeTypes, $affectedNodeTypes);
} else {
$abstainedCreationNodeTypes = array_merge($abstainedCreationNodeTypes, $affectedNodeTypes);
}
}
}
$implicitlyDeniedNodeTypes = array_diff($abstainedCreationNodeTypes, $grantedCreationNodeTypes);
return array_merge($implicitlyDeniedNodeTypes, $deniedCreationNodeTypes);
}
作者:robertlemk
项目:neos-development-collectio
/**
* Converts the nodes types to a fully structured array
* in the same structure as the schema to be created.
*
* The schema also includes abstract node types for the full inheritance information in VIE.
*
* @return object
*/
public function generateVieSchema()
{
if ($this->configuration !== null) {
return $this->configuration;
}
$nodeTypes = $this->nodeTypeManager->getNodeTypes();
foreach ($nodeTypes as $nodeTypeName => $nodeType) {
$this->readNodeTypeConfiguration($nodeTypeName, $nodeType);
}
unset($this->types['typo3:unstructured']);
foreach ($this->types as $nodeTypeName => $nodeTypeDefinition) {
$this->types[$nodeTypeName]->subtypes = $this->getAllSubtypes($nodeTypeName);
$this->types[$nodeTypeName]->ancestors = $this->getAllAncestors($nodeTypeName);
$this->removeUndeclaredTypes($this->types[$nodeTypeName]->supertypes);
$this->removeUndeclaredTypes($this->types[$nodeTypeName]->ancestors);
}
foreach ($this->properties as $property => $propertyConfiguration) {
if (isset($propertyConfiguration->domains) && is_array($propertyConfiguration->domains)) {
foreach ($propertyConfiguration->domains as $domain) {
if (preg_match('/TYPO3\\.Neos\\.NodeTypes:.*Column/', $domain)) {
$this->properties[$property]->ranges = array_keys($this->types);
}
}
}
}
// Convert the TYPO3.Neos:ContentCollection element to support content-collection
// TODO Move to node type definition
if (isset($this->types['typo3:TYPO3.Neos:ContentCollection'])) {
$this->addProperty('typo3:TYPO3.Neos:ContentCollection', 'typo3:content-collection', array());
$this->types['typo3:TYPO3.Neos:ContentCollection']->specific_properties[] = 'typo3:content-collection';
$this->properties['typo3:content-collection']->ranges = array_keys($this->types);
}
$this->configuration = (object) array('types' => (object) $this->types, 'properties' => (object) $this->properties);
return $this->configuration;
}
作者:hlube
项目:neos-development-collectio
/**
* Render the label for the given $nodeTypeName
*
* @param string $nodeTypeName
* @throws \TYPO3\TYPO3CR\Exception\NodeTypeNotFoundException
* @return string
*/
public function labelForNodeType($nodeTypeName)
{
if (!$this->nodeTypeManager->hasNodeType($nodeTypeName)) {
$explodedNodeTypeName = explode(':', $nodeTypeName);
return end($explodedNodeTypeName);
}
$nodeType = $this->nodeTypeManager->getNodeType($nodeTypeName);
return $nodeType->getLabel();
}
作者:neo
项目:neos-u
/**
* Set the node type
*
* @param string $nodeType
*/
public function setNodeType($nodeType)
{
if (is_string($nodeType)) {
$nodeType = $this->nodeTypeManager->getNodeType($nodeType);
}
if (!$nodeType instanceof NodeType) {
throw new \InvalidArgumentException('nodeType needs to be of type string or NodeType', 1452100970);
}
$this->nodeType = $nodeType;
}
作者:mgoldbec
项目:neos-development-collectio
/**
* @test
*/
public function readNodeTypeConfigurationFillsTypeAndPropertyConfiguration()
{
$this->assertEquals($this->vieSchemaBuilder->_get('superTypeConfiguration'), array());
$this->assertEquals($this->vieSchemaBuilder->_get('types'), array());
$this->assertEquals($this->vieSchemaBuilder->_get('properties'), array());
$this->vieSchemaBuilder->_call('readNodeTypeConfiguration', 'TYPO3.Neos:TextWithImage', $this->nodeTypeManager->getNodeType('TYPO3.Neos:TextWithImage'));
$this->assertEquals(array('typo3:TYPO3.Neos:TextWithImage' => array('typo3:TYPO3.Neos:Text')), $this->vieSchemaBuilder->_get('superTypeConfiguration'));
$this->arrayHasKey('typo3:TYPO3.Neos:TextWithImage', $this->vieSchemaBuilder->_get('types'));
$this->assertEquals(4, count($this->vieSchemaBuilder->_get('properties')));
}
作者:kuborgh-mspindelhir
项目:Flowpack.SimpleSearch.ContentRepositoryAdapto
/**
* Called by the Flow object framework after creating the object and resolving all dependencies.
*
* @param integer $cause Creation cause
*/
public function initializeObject($cause)
{
parent::initializeObject($cause);
foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) {
$searchSettingsForNodeType = $nodeType->getConfiguration('search');
if (is_array($searchSettingsForNodeType) && isset($searchSettingsForNodeType['fulltext']['isRoot']) && $searchSettingsForNodeType['fulltext']['isRoot'] === TRUE) {
$this->fulltextRootNodeTypes[] = $nodeType->getName();
}
}
}
作者:radmiraa
项目:TYPO3.TYPO3C
/**
* Returns TRUE if the given node is of the node type this filter expects.
*
* @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
* @return boolean
*/
public function matches(\TYPO3\TYPO3CR\Domain\Model\NodeInterface $node)
{
if ($this->withSubTypes === TRUE) {
return $this->nodeTypeManager->getNodeType($node->getNodeType())->isOfType($this->nodeTypeName);
} else {
$nodeData = \TYPO3\Flow\Reflection\ObjectAccess::getProperty($node, 'nodeData', TRUE);
$nodeType = \TYPO3\Flow\Reflection\ObjectAccess::getProperty($nodeData, 'nodeType', TRUE);
return $nodeType === $this->nodeTypeName;
}
}
作者:desaisaga
项目:Lelesys.Plugin.ContactFor
/**
* Executes this finisher
* @see AbstractFinisher::execute()
*
* @return void
* @throws \TYPO3\Form\Exception\FinisherException
*/
protected function executeInternal()
{
$formValues = $this->finisherContext->getFormValues();
$formNode = $this->formRegistry->getFormNode($this->finisherContext->getFormRuntime()->getIdentifier());
$slug = uniqid('post');
$postNode = $formNode->getParent()->createNode($slug, $this->nodeTypeManager->getNodeType('Lelesys.Plugin.ContactForm:FormPost'));
foreach ($formValues as $propertyName => $value) {
$postNode->setProperty($propertyName, $value);
}
$postNode->setProperty('postDateTime', time());
}
作者:simonschauf
项目:neos-development-collectio
/**
* @test
*/
public function findNodesByRelatedEntitiesFindsExistingNodeWithMatchingEntityProperty()
{
$rootNode = $this->context->getRootNode();
$newNode = $rootNode->createNode('test', $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:NodeTypeWithEntities'));
$testImage = new Image();
$this->persistenceManager->add($testImage);
$newNode->setProperty('image', $testImage);
$this->persistenceManager->persistAll();
$relationMap = array('TYPO3\\Flow\\Tests\\Functional\\Persistence\\Fixtures\\Image' => array($this->persistenceManager->getIdentifierByObject($testImage)));
$result = $this->nodeDataRepository->findNodesByRelatedEntities($relationMap);
$this->assertCount(1, $result);
}
作者:Weissheite
项目:Sfi.Share
/**
* If AssetList contains only 1 file, and it's of type Audio, turn it into targetNodeType
*
* @param \TYPO3\TYPO3CR\Domain\Model\NodeData $node
* @return void
*/
public function execute(\TYPO3\TYPO3CR\Domain\Model\NodeData $node)
{
$assets = $node->getProperty($this->sourcePropertyName);
if (count($assets) === 1) {
$asset = $assets[0];
if ($asset instanceof $this->assetType) {
$nodeType = $this->nodeTypeManager->getNodeType($this->targetNodeType);
$node->setNodeType($nodeType);
$node->setProperty($this->targetPropertyName, $asset);
$node->removeProperty($this->sourcePropertyName);
echo "Converted AssetList with asset of type" . $this->assetType . " to node of type " . $this->targetNodeType . "\n";
}
}
}
作者:egobud
项目:Egobude.Product
/**
* importProduct
*
* @param array $product
* @param NodeInterface $startingPointProducts
* @param Context $context
*/
private function importProduct(array $product, NodeInterface $startingPointProducts, Context $context)
{
$nodeTemplate = new NodeTemplate();
$nodeTemplate->setNodeType($this->nodeTypeManager->getNodeType('Egobude.Products:Product'));
$nodeTemplate->setProperty('title', $product['title']);
$nodeTemplate->setProperty('sku', $product['sku']);
$nodeTemplate->setProperty('price', $product['price']);
$similarProducts = $this->getRandomProducts($context, $startingPointProducts);
if (!empty($similarProducts)) {
$nodeTemplate->setProperty('similarProducts', $similarProducts);
}
$accessories = $this->getRandomProducts($context, $startingPointProducts);
if (!empty($accessories)) {
$nodeTemplate->setProperty('accessories', $accessories);
}
$productNode = $startingPointProducts->createNodeFromTemplate($nodeTemplate);
if (!empty($product['description'])) {
$description = $product['description'];
$mainContentNode = $productNode->getNode('main');
$bodyTemplate = new NodeTemplate();
$bodyTemplate->setNodeType($this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Text'));
$bodyTemplate->setProperty('text', $description);
$mainContentNode->createNodeFromTemplate($bodyTemplate);
}
}
作者:testbir
项目:neos-development-collectio
/**
* @param QueryInterface $query
* @param $nodeTypeFilter
* @return array
*/
protected function getNodeTypeFilterConstraints(QueryInterface $query, $nodeTypeFilter)
{
$includeNodeTypeConstraints = array();
$excludeNodeTypeConstraints = array();
$nodeTypeFilterParts = Arrays::trimExplode(',', $nodeTypeFilter);
foreach ($nodeTypeFilterParts as $nodeTypeFilterPart) {
$nodeTypeFilterPart = trim($nodeTypeFilterPart);
if (strpos($nodeTypeFilterPart, '!') === 0) {
$negate = true;
$nodeTypeFilterPart = substr($nodeTypeFilterPart, 1);
} else {
$negate = false;
}
$nodeTypeFilterPartSubTypes = array_merge(array($nodeTypeFilterPart), $this->nodeTypeManager->getSubNodeTypes($nodeTypeFilterPart, false));
foreach ($nodeTypeFilterPartSubTypes as $nodeTypeFilterPartSubType) {
if ($negate === true) {
$excludeNodeTypeConstraints[] = $query->logicalNot($query->equals('nodeType', $nodeTypeFilterPartSubType));
} else {
$includeNodeTypeConstraints[] = $query->equals('nodeType', $nodeTypeFilterPartSubType);
}
}
}
$constraints = $excludeNodeTypeConstraints;
if (count($includeNodeTypeConstraints) > 0) {
$constraints[] = $query->logicalOr($includeNodeTypeConstraints);
}
return $constraints;
}