mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-08 17:34:32 +02:00
Renamed the base DBElement classes to AbstractDBElement to comply with symfony recommendations.
This commit is contained in:
parent
da72f5b3ec
commit
594c694ee0
62 changed files with 203 additions and 203 deletions
|
@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services\Trees;
|
||||
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
use App\Services\UserCacheKeyGenerator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
@ -52,11 +52,11 @@ class NodesListBuilder
|
|||
* In difference to the Repository Function, the results here are cached.
|
||||
*
|
||||
* @param string $class_name The class name of the entity you want to retrieve.
|
||||
* @param StructuralDBElement|null $parent This entity will be used as root element. Set to null, to use global root
|
||||
* @param AbstractStructuralDBElement|null $parent This entity will be used as root element. Set to null, to use global root
|
||||
*
|
||||
* @return StructuralDBElement[] A flattened list containing the tree elements.
|
||||
* @return AbstractStructuralDBElement[] A flattened list containing the tree elements.
|
||||
*/
|
||||
public function typeToNodesList(string $class_name, ?StructuralDBElement $parent = null): array
|
||||
public function typeToNodesList(string $class_name, ?AbstractStructuralDBElement $parent = null): array
|
||||
{
|
||||
$parent_id = null !== $parent ? $parent->getID() : '0';
|
||||
// Backslashes are not allowed in cache keys
|
||||
|
|
|
@ -24,9 +24,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services\Trees;
|
||||
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Helpers\Trees\TreeViewNode;
|
||||
use App\Helpers\Trees\TreeViewNodeIterator;
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
|
@ -59,14 +59,14 @@ class TreeViewGenerator
|
|||
* Gets a TreeView list for the entities of the given class.
|
||||
*
|
||||
* @param string $class The class for which the treeView should be generated
|
||||
* @param StructuralDBElement|null $parent The root nodes in the tree should have this element as parent (use null, if you want to get all entities)
|
||||
* @param AbstractStructuralDBElement|null $parent The root nodes in the tree should have this element as parent (use null, if you want to get all entities)
|
||||
* @param string $href_type The link type that will be generated for the hyperlink section of each node (see EntityURLGenerator for possible values).
|
||||
* Set to empty string, to disable href field.
|
||||
* @param DBElement|null $selectedElement The element that should be selected. If set to null, no element will be selected.
|
||||
* @param AbstractDBElement|null $selectedElement The element that should be selected. If set to null, no element will be selected.
|
||||
*
|
||||
* @return TreeViewNode[] An array of TreeViewNode[] elements of the root elements.
|
||||
*/
|
||||
public function getTreeView(string $class, ?StructuralDBElement $parent = null, string $href_type = 'list_parts', ?DBElement $selectedElement = null): array
|
||||
public function getTreeView(string $class, ?AbstractStructuralDBElement $parent = null, string $href_type = 'list_parts', ?AbstractDBElement $selectedElement = null): array
|
||||
{
|
||||
$head = [];
|
||||
|
||||
|
@ -115,13 +115,13 @@ class TreeViewGenerator
|
|||
* The treeview is generic, that means the href are null and ID values are set.
|
||||
*
|
||||
* @param string $class The class for which the tree should be generated
|
||||
* @param StructuralDBElement|null $parent The parent the root elements should have.
|
||||
* @param AbstractStructuralDBElement|null $parent The parent the root elements should have.
|
||||
*
|
||||
* @return TreeViewNode[]
|
||||
*/
|
||||
public function getGenericTree(string $class, ?StructuralDBElement $parent = null): array
|
||||
public function getGenericTree(string $class, ?AbstractStructuralDBElement $parent = null): array
|
||||
{
|
||||
if (! is_a($class, NamedDBElement::class, true)) {
|
||||
if (! is_a($class, AbstractNamedDBElement::class, true)) {
|
||||
throw new \InvalidArgumentException('$class must be a class string that implements StructuralDBElement or NamedDBElement!');
|
||||
}
|
||||
if (null !== $parent && ! is_a($parent, $class)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue