Conditions | 1 |
Paths | 1 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
33 | protected function setParent(ObjectEntity $entity, string $folder): void |
||
34 | { |
||
35 | /** @var \BEdita\Core\Model\Table\FoldersTable $foldersTable */ |
||
36 | $foldersTable = $this->fetchTable('Folders'); |
||
37 | $parentId = $foldersTable->getId($folder); |
||
38 | $parentEntity = $foldersTable->get($parentId); |
||
39 | $association = $entity->getTable()->associations()->getByProperty('parents'); |
||
40 | $action = new SetRelatedObjectsAction(compact('association')); |
||
41 | $relatedEntities = [$parentEntity]; |
||
42 | $action(compact('entity', 'relatedEntities')); |
||
43 | } |
||
45 |