mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-03 05:55:16 +01:00
Implemented a filter constraint for entities
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user