so I have a need of creating some complex caching system when I need to know every item that was used in a view right now I am getting this data from controller but its log ugly and creating a fat controllers like:
$post = $this->repository->byId(1);
CacheManager::addTags($post->comments);
foreach ($post->comments as $comment) {
CacheManager::addTags([$comment, $comment->user]);
}
foreach ($post->photos as $photo) {
foreach ($photo->types as $type) {
CacheManager::addTags([$type->id]);
}
}
so I was thinking is there some clever way of getting all the data that was used in a view? like getting all this calls
so I will know that a comment was used in the view and insert it into the CacheManager
via Amir Bar