Pimcore\Model\Object\ClassDefinition\Data\Objectbricks::getCacheTags PHP Method

getCacheTags() public method

This is a dummy and is mostly implemented by relation types
public getCacheTags ( mixed $data, array $tags = [] ) : array
$data mixed
$tags array
return array
    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;
    }