$parentId = null;
if ($album->
getParent()) { $parentId =
$album->
getParent()->
getId();
} $node =
[ 'id' =>
$album->
getId(),
'text' =>
$album->
getName(),
'position' =>
$album->
getPosition(),
'garbageCollectable' =>
$album->
getGarbageCollectable(),
'mediaCount' =>
$totalResult,
'parentId' =>
$parentId,
];
// To get fresh album settings from new albums too
$settingsQuery =
$repository->
getAlbumWithSettingsQuery($album->
getId());
$albumData =
$settingsQuery->
getOneOrNullResult(AbstractQuery::HYDRATE_ARRAY
);
$settings =
$albumData['settings'
];
if (!
empty($settings)) { $node['iconCls'
] =
$settings['icon'
];