public findByTag ( |
||
$tag | ||
$assetCollection | ||
return | Neos\Flow\Persistence\QueryResultInterface |
public function findByTag(Tag $tag, AssetCollection $assetCollection = null)
{
$query = $this->createQuery();
$query->matching($query->contains('tags', $tag));
$this->addImageVariantFilterClause($query);
$this->addAssetCollectionToQueryConstraints($query, $assetCollection);
return $query->execute();
}
/** * @param Tag $tag * @return void */ public function deleteTagAction(Tag $tag) { $taggedAssets = $this->assetRepository->findByTag($tag); foreach ($taggedAssets as $asset) { $asset->removeTag($tag); $this->assetRepository->update($asset); } $this->tagRepository->remove($tag); $this->addFlashMessage('tagHasBeenDeleted', '', Message::SEVERITY_OK, [htmlspecialchars($tag->getLabel())]); $this->redirect('index'); }