public function getCacheTags($data, $tags = [])
{
$tags = is_array($tags) ? $tags : [];
if ($data instanceof Object\Objectbrick) {
$items = $data->getItems();
foreach ($items as $item) {
if (!$item instanceof Object\Objectbrick\Data\AbstractData) {
continue;
}
try {
$collectionDef = Object\Objectbrick\Definition::getByKey($item->getType());
} catch (\Exception $e) {
continue;
}
foreach ($collectionDef->getFieldDefinitions() as $fd) {
$key = $fd->getName();
$getter = "get" . ucfirst($key);
$tags = $fd->getCacheTags($item->{$getter}(), $tags);
}
}
}
return $tags;
}