|
24 | 24 | use Pimcore\Bundle\StudioBackendBundle\Element\Service\ElementServiceInterface; |
25 | 25 | use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; |
26 | 26 | use Pimcore\Bundle\StudioBackendBundle\Util\Constant\ElementTypes; |
| 27 | +use Pimcore\Model\DataObject; |
27 | 28 | use Pimcore\Model\DataObject\ClassDefinition; |
28 | | -use Pimcore\Model\DataObject\Folder; |
29 | 29 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
30 | 30 | use function count; |
31 | 31 |
|
@@ -69,15 +69,15 @@ public function getTree(bool $grouped = false): array |
69 | 69 | return $hydrated; |
70 | 70 | } |
71 | 71 |
|
72 | | - public function getClassDefinitionIdsInsideFolder(int $folderId): array |
| 72 | + public function getChildrenClassDefinitionIds(int $parentId): array |
73 | 73 | { |
74 | | - $folder = $this->elementService->getElementById(ElementTypes::TYPE_DATA_OBJECT, $folderId); |
75 | | - if (!$folder instanceof Folder) { |
76 | | - throw new NotFoundException(ElementTypes::TYPE_DATA_OBJECT . ' Folder', $folderId); |
| 74 | + $object = $this->elementService->getElementById(ElementTypes::TYPE_DATA_OBJECT, $parentId); |
| 75 | + if (!$object instanceof DataObject) { |
| 76 | + throw new NotFoundException(ElementTypes::TYPE_DATA_OBJECT . ' Parent', $parentId); |
77 | 77 | } |
78 | 78 |
|
79 | 79 | $hydratedClassDefinitions = []; |
80 | | - foreach ($folder->getDao()->getClasses() as $classDefinition) { |
| 80 | + foreach ($object->getDao()->getClasses() as $classDefinition) { |
81 | 81 | $class = $this->classDefinitionFolderListHydrator->hydrate($classDefinition); |
82 | 82 | $this->eventDispatcher->dispatch( |
83 | 83 | new ClassDefinitionFolderListEvent($class), |
|
0 commit comments