mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
PHRAS-676 #time 3h
new : returns facet on "type" (image, video, ...) new : query on pseudo-field "type", ex: "type:image"
This commit is contained in:
@@ -88,6 +88,9 @@ class QueryVisitor implements Visit
|
||||
case NodeTypes::COLLECTION:
|
||||
return $this->visitCollectionNode($element);
|
||||
|
||||
case NodeTypes::TYPE:
|
||||
return $this->visitTypeNode($element);
|
||||
|
||||
case NodeTypes::IDENTIFIER:
|
||||
return $this->visitIdentifierNode($element);
|
||||
|
||||
@@ -279,6 +282,16 @@ class QueryVisitor implements Visit
|
||||
return new AST\CollectionExpression($collectionName);
|
||||
}
|
||||
|
||||
private function visitTypeNode(Element $element)
|
||||
{
|
||||
if ($element->getChildrenNumber() !== 1) {
|
||||
throw new \Exception('Type filter can only have a single child.');
|
||||
}
|
||||
$typeName = $element->getChild(0)->getValue()['value'];
|
||||
|
||||
return new AST\TypeExpression($typeName);
|
||||
}
|
||||
|
||||
private function visitIdentifierNode(Element $element)
|
||||
{
|
||||
if ($element->getChildrenNumber() !== 1) {
|
||||
|
Reference in New Issue
Block a user