Propagates a given entity-changed event to all attached entity-changed listeners.

@param EntityChangedEvent $event
352113
protected function propagateEntityChangedEvent(EntityChangedEvent $event)
    {
        foreach ($this->listeners as $listener) {
            $listener->onEntityChanged($event);
        }
    }
1318203
public function onPostBind($event)
    {
        $form = $event->getForm();

        if ( ! $form->isRoot()) return;

        $clientData = $event->getForm()->getData();

        if ( ! is_object($clientData)) return;

        $this->filterService->filterEntity($clientData);

    }
586192
public function determineEventBinding(Event $event)
    {
        switch ($event->getCode()) {
            case Event::RESOURCE_DELETED:
                return 'delete';
                break;
            case Event::RESOURCE_CREATED:
                return 'create';
                break;
            case Event::RESOURCE_MODIFIED:
                return 'modify';
            break;
        }
    }
1152066
public static function onBeforeSave(Event $event)
    {
        $layout = $event->getTarget();
        if (!is_a($layout, 'BackBee\Site\Layout')) {
            return;
        }

        $dispatcher = $event->getDispatcher();
        if (null !== $dispatcher->getApplication()) {
            if (is_a($event->getEventArgs(), 'Doctrine\ORM\Event\PreUpdateEventArgs')) {
                if (!$event->getEventArgs()->hasChangedField('_data')) {
                    return;
                }
            }

            // Update the layout thumbnail - Beware of generate thumbnail before any other operation
            $thumb = $dispatcher->getApplication()->getEntityManager()
                    ->getRepository('BackBee\Site\Layout')
                    ->generateThumbnail($layout, $dispatcher->getApplication());

            // Update the layout file
            try {
                $dispatcher->getApplication()->getRenderer()->updateLayout($layout);
            } catch (\BackBee\Renderer\Exception\RendererException $e) {
                $dispatcher->getApplication()->warning($e->getMessage());
            }

            if (is_a($event->getEventArgs(), 'Doctrine\ORM\Event\PreUpdateEventArgs')) {
                if ($event->getEventArgs()->hasChangedField('_picpath')) {
                    $event->getEventArgs()->setNewValue('_picpath', $thumb);
                }
            }
        }
    }
668324
public function triggerEvent($eventName, $entity, $eventArgs = null, Event $event = null)
    {
        if (null === $event) {
            $event = new Event($entity, $eventArgs);
        }

        $this->dispatch($this->formatEventName($eventName, $entity), $event);

        if ($entity instanceof AbstractClassContent) {
            foreach (class_parents($entity) as $class) {
                if ($class === 'BackBee\ClassContent\AbstractClassContent') {
                    break;
                }

                $this->dispatch($this->formatEventName($eventName, $class), $event);
            }

            $this->dispatch(strtolower('classcontent.'.$eventName), $event);
        }
    }
890109
public function beforePersist(EntityLifecycleEvent $event)
    {
        foreach ($this->getConfiguration() as $entityClassName => $propertyConfiguration) {
            if ($event->getEntity() instanceof $entityClassName) {
                /** @var Repository $repository */
                $entity = $event->getEntity();
                $repository = $event->getRepository();
                foreach ($propertyConfiguration as $propertyName => $configuration) {
                    $this->updateEntity($propertyName, $entity, $repository, $configuration);
                }
            }
        }
    }
587703
public function stateChanged(StateChangeEvent $event) {
    $object = $event->getObject();

    // make sure the event contains an object and don't listen to detached object changes
    if (!$object || in_array($object->getOID()->__toString(), array_map(function($obj) {
      return $obj ? $obj->getOID()->__toString() : null;
    }, $this->detachedObjects))) {
      return;
    }

    $oldState = $event->getOldValue();
    $newState = $event->getNewValue();
    if (self::$isDebugEnabled) {
      self::$logger->debug("State changed: ".$object->getOID()." old:".$oldState." new:".$newState);
    }
    switch ($newState) {
      case PersistentObject::STATE_NEW:
        $this->registerNew($object);
        break;

      case PersistentObject::STATE_DIRTY:
        $this->registerDirty($object);
        break;

      case PersistentObject::STATE_DELETED:
        $this->registerDeleted($object);
        break;
    }
  }
955190
protected function execute($event)
    {
        foreach($this->events[$event] as $handler) {
            $this->listen($event, $handler);
        }
    }
507435
public function addListeners($event, $listeners)
    {
        foreach ($listeners as $listener) {
            $this->addListener($event, $listener);
        }
    }
602046
public function attach($event)
    {
        $this->attachRows($event);
        $this->attachSeo($event);
        $this->attachAnonsModule($event);
    }
1022359
public function onUpdateRunNodeEvents(NodeEvent $event)
    {
        $node = $event->getNode();

        $this->ensureNodeSubscribers($event);

        $newEvent = new ResourceEvent('node', $node->nid, $this->currentUser->id());

        if ($node->is_flagged != $node->original->is_flagged) {
            if ($node->is_flagged) {
                $this->dispatcher->dispatch('node:flag', $newEvent);
            }
        } else if ($node->status != $node->original->status) {
            if ($node->status) {
                $this->dispatcher->dispatch('node:publish', $newEvent);
            } else {
                $this->dispatcher->dispatch('node:unpublish', $newEvent);
            }
        } else {
            $this->dispatcher->dispatch('node:edit', $newEvent);
        }
    }
1293842
public function handle(Event $event)
    {
        $name = $event->getName();
        $emitter = $event->getEmitter();
        $emitter->removeListener($name, $this);

        unset($name, $emitter);

        call_user_func_array($this->handler, [$event]);
    }
416985
public function beforeSave(Event $event, Entity $entity) {
        if(!$entity->get('slug') || $this->_config['overwrite'])
            $entity->set('slug', $this->slug($entity->get($this->_config['field'])));
    }
1288317
public function listen(Event $event)
    {
        if (!empty($this->handledEvents[$event->getName()])) {
            return;
        }
        $this->handledEvents[$event->getName()] = true;
        // Plugin has been uninstalled
        if (!file_exists(__FILE__) || !file_exists(__DIR__ . '/PluginImplementation.php')) {
            return;
        }

        // Load the implementation only after updating Composer so that we get
        // the new version of the plugin when a new one was installed
        if (null === $this->pluginImplementation) {
            $this->pluginImplementation = new PluginImplementation($event);
        }

        switch ($event->getName()) {
            case ScriptEvents::PRE_AUTOLOAD_DUMP:
                $this->pluginImplementation->preAutoloadDump();
                break;
            case ScriptEvents::POST_AUTOLOAD_DUMP:
                $this->pluginImplementation->postAutoloadDump();
                break;
        }
    }
1020315
public function beforeSave(Event $event, EntityInterface $entity) {
		if (!$this->_isFileUploadPresent($entity)) {
			$event->stopPropagation();

			return;
		}

		$this->_checkEntityBeforeSave($entity);

		$this->dispatchEvent('FileStorage.beforeSave', [
			'entity' => $entity,
			'storageAdapter' => $this->getStorageAdapter($entity->get('adapter'))
		], $this->_table);
	}
202655
public function remove(EntityRemoved $event)
    {
        $entity = $event->getEntity();
        $collection = $event->getCollection();
        $this->deleteRelation($entity, $collection);
    }
738253
public function beforeSave(Event $event, Entity $entity) {
		if (isset($entity['ext'])) {
			$entity['ext'] = mb_strtolower($entity['ext']);
		}
		if (isset($entity['name'])) {
			$entity['name'] = ucwords($entity['name']);
		}
	}