public function fetchEntityFromCache(EntityLoadEvent $event)
    {
        $entity = $event->getEntity();
        // Check cache
        if (false !== $data = $this->cache->get($entity)) {

            // Set data from cache to entity object
            $entity->setDataFromCache($data);
            $entity->setIsLoaded(true);
            $this->dispatcher->dispatch('cache.load', new CacheEvent($entity));

        }
    }
public function fetchEntityFromCache(EntityLoadEvent $event)
    {
        $entity = $event->getEntity();
        // Check cache
        if (false !== $data = $this->cache->get($entity)) {

            // Set data from cache to entity object
            $entity->setDataFromCache($data);
            $entity->setIsLoaded(true);
            $this->dispatcher->dispatch('cache.load', new CacheEvent($entity));

        }
    }
public function fetchEntityFromCache ( EntityLoadEvent $ event ) { $ entity = $ event -> getEntity ( ) ; // Check cache if ( false !== $ data = $ this -> cache -> get ( $ entity ) ) { // Set data from cache to entity object $ entity -> setDataFromCache ( $ data ) ; $ entity -> setIsLoaded ( true ) ; $ this -> dispatcher -> dispatch ( 'cache.load' , new CacheEvent ( $ entity ) ) ; } }
Load data from cache

@param EntityLoadEvent $event

@return void
Load data from cache