public function getRoots($condition = null, $lang = null, $domain = 0)
{
$storageController = $this->objects->getStorageController($this->getObject());
if (!$this->getObjectDefinition()->isNested()) {
throw new \Exception('Object is not a nested set.');
}
$options['fields'] = $this->getNestedSelection($this->getObjectDefinition()->getNestedRootObjectLabelField());
if ($this->getObjectDefinition()->getNestedRootAsObject()) {
$rootObjectKey = Objects::normalizeObjectKey($this->getObjectDefinition()->getNestedRootObject());
$filter = [];
if ($domain) {
if ('jarves/domain' === $rootObjectKey) {
$filter['id'] = $domain;
} else {
$filter['domain'] = $domain;
}
}
if ($lang) {
$filter['lang'] = $lang;
}
// $rootCondition = new Condition();
// $rootCondition->addAnd(['id', '=', $domain]);
return $this->objects->getList($rootObjectKey, $filter, $options);
} else {
// $conditionObject = $condition ?: new Condition(null, $this->jarves);
//
// if ($this->getPermissionCheck() && $aclCondition = $this->acl->getListingCondition($this->getObject())) {
// $conditionObject->mergeAndBegin($aclCondition);
// }
return $storageController->getRoots(null, $options);
}
}