public static function getByTargetType($type, $subTypes)
{
if ($type != "asset") {
throw new \Exception("other types than assets are currently not supported");
}
$list = new self();
if ($subTypes && !is_array($subTypes)) {
$subTypes = [$subTypes];
}
if (is_array($subTypes)) {
$list->setFilter(function ($row) use($subTypes) {
if (empty($row["targetSubtype"])) {
return true;
}
if (in_array($row["targetSubtype"], $subTypes)) {
return true;
}
return false;
});
}
$list = $list->load();
return $list;
}