This method is internal and will be replaced with better search capabilities.
public findByProperties ( string | array $term, string $nodeTypeFilter, |
||
$term | string | array | Search term |
$nodeTypeFilter | string | Node type filter |
$workspace | ||
$dimensions | array | |
$pathStartingPoint | string | |
Résultat | array<\Neos\ContentRepository\Domain\Model\NodeData> |
/** * Search all properties for given $term * * TODO: Implement a better search when Flow offer the possibility * * @param string|array $term search term * @param array $searchNodeTypes * @param Context $context * @param NodeInterface $startingPoint * @return array <\Neos\ContentRepository\Domain\Model\NodeInterface> */ public function findByProperties($term, array $searchNodeTypes, Context $context, NodeInterface $startingPoint = null) { if (empty($term)) { throw new \InvalidArgumentException('"term" cannot be empty: provide a term to search for.', 1421329285); } $searchResult = array(); $nodeTypeFilter = implode(',', $searchNodeTypes); $nodeDataRecords = $this->nodeDataRepository->findByProperties($term, $nodeTypeFilter, $context->getWorkspace(), $context->getDimensions(), $startingPoint ? $startingPoint->getPath() : null); foreach ($nodeDataRecords as $nodeData) { $node = $this->nodeFactory->createFromNodeData($nodeData, $context); if ($node !== null) { $searchResult[$node->getPath()] = $node; } } return $searchResult; }
/** * @test */ public function findNodesByPropertyKeyAndValue() { $this->createNodesForNodeSearchTest(); $result = $this->nodeDataRepository->findByProperties(array('test2' => 'simpleTestValue'), 'Neos.ContentRepository.Testing:NodeType', $this->liveWorkspace, $this->context->getDimensions()); $this->assertCount(1, $result); $this->assertEquals('test-node-2', array_shift($result)->getName()); }