Implemented a filter constraint for entities

This commit is contained in:
Jan Böhmer 2022-08-21 01:34:17 +02:00
parent 0bc9d8cba1
commit c9151c65ba
13 changed files with 810 additions and 27 deletions

View file

@ -84,10 +84,20 @@ class NodesListBuilder
return $this->cache->get($key, function (ItemInterface $item) use ($class_name, $parent, $secure_class_name) {
// Invalidate when groups, a element with the class or the user changes
$item->tag(['groups', 'tree_list', $this->keyGenerator->generateKey(), $secure_class_name]);
/** @var StructuralDBElementRepository */
$repo = $this->em->getRepository($class_name);
return $repo->toNodesList($parent);
return $this->em->getRepository($class_name)->toNodesList($parent);
});
}
/**
* Returns a flattened list of all (recursive) children elements of the given AbstractStructuralDBElement.
* The value is cached for performance reasons.
*
* @template T
* @param T $element
* @return T[]
*/
public function getChildrenFlatList(AbstractStructuralDBElement $element): array
{
return $this->typeToNodesList(get_class($element), $element);
}
}