public findBySearchTerm ( string $searchTerm ) : Neos\Flow\Persistence\QueryResultInterface | ||
$searchTerm | string | |
Résultat | Neos\Flow\Persistence\QueryResultInterface |
/** * @test */ public function findBySearchTermReturnsFilteredResult() { $tag1 = new Tag('foobar'); $tag2 = new Tag('foo bar'); $tag3 = new Tag('bar foo bar'); $this->tagRepository->add($tag1); $this->tagRepository->add($tag2); $this->tagRepository->add($tag3); $this->persistenceManager->persistAll(); $this->persistenceManager->clearState(); $this->assertCount(3, $this->tagRepository->findBySearchTerm('foo')); $this->assertCount(2, $this->tagRepository->findBySearchTerm('foo bar')); $this->assertCount(1, $this->tagRepository->findBySearchTerm(' foo ')); }
/** * Shows a list of assets * * @param string $searchTerm An optional search term used for filtering the list of assets * @return string */ public function indexAction($searchTerm = '') { $assets = $this->assetRepository->findBySearchTermOrTags($searchTerm, $this->tagRepository->findBySearchTerm($searchTerm)->toArray()); $this->view->assign('assets', $assets); }