Example #1
0
 /**
  * Set cache
  *
  * @param EntityLoadEvent $event
  *
  * @return void
  */
 public function setCacheForEntity(EntityLoadEvent $event)
 {
     $entity = $event->getEntity();
     if (!$entity->isLoaded()) {
         $this->cache->set($entity);
         $this->dispatcher->dispatch('cache.set', new CacheEvent($entity));
     }
 }
Example #2
0
 public function testEntity()
 {
     $entity = new Entity();
     $event = new EntityLoadEvent($entity);
     $this->assertEquals($entity, $event->getEntity());
 }