forked from mirror/Part-DB.Part-DB-server
Applied rector with PHP8.1 migration rules
This commit is contained in:
parent
dc6a67c2f0
commit
7ee01d9a05
303 changed files with 1228 additions and 3465 deletions
|
@ -35,13 +35,8 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface;
|
|||
|
||||
class TreeCacheInvalidationListener
|
||||
{
|
||||
protected TagAwareCacheInterface $cache;
|
||||
protected UserCacheKeyGenerator $keyGenerator;
|
||||
|
||||
public function __construct(TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator)
|
||||
public function __construct(protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator)
|
||||
{
|
||||
$this->cache = $treeCache;
|
||||
$this->keyGenerator = $keyGenerator;
|
||||
}
|
||||
|
||||
#[ORM\PostUpdate]
|
||||
|
@ -51,7 +46,7 @@ class TreeCacheInvalidationListener
|
|||
{
|
||||
//If an element was changed, then invalidate all cached trees with this element class
|
||||
if ($element instanceof AbstractStructuralDBElement || $element instanceof LabelProfile) {
|
||||
$secure_class_name = str_replace('\\', '_', get_class($element));
|
||||
$secure_class_name = str_replace('\\', '_', $element::class);
|
||||
$this->cache->invalidateTags([$secure_class_name]);
|
||||
|
||||
//Trigger a sidebar reload for all users (see SidebarTreeUpdater service)
|
||||
|
@ -62,7 +57,7 @@ class TreeCacheInvalidationListener
|
|||
|
||||
//If a user change, then invalidate all cached trees for him
|
||||
if ($element instanceof User) {
|
||||
$secure_class_name = str_replace('\\', '_', get_class($element));
|
||||
$secure_class_name = str_replace('\\', '_', $element::class);
|
||||
$tag = $this->keyGenerator->generateKey($element);
|
||||
$this->cache->invalidateTags([$tag, $secure_class_name]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue