public static function getIdList($list, $idGetter = 'getId')
{
$ids = [];
if (is_array($list)) {
foreach ($list as $entry) {
if (is_object($entry) && method_exists($entry, $idGetter)) {
$ids[] = $entry->{$idGetter}();
} elseif (is_scalar($entry)) {
$ids[] = $entry;
}
}
}
if ($list instanceof \Pimcore\Model\Listing\AbstractListing) {
$ids = $list->loadIdList();
}
$ids = array_unique($ids);
return $ids;
}