Inject the correct collection name for entity queries.

@param  Guzzle\Common\Event
@return void
776725
public function beforePrepare(Event $event)
	{
		$operation = $event['command']->getOperation();
		$client = $event['command']->getClient();

		if ($operation->hasParam('collection') === false) return;
		if (is_null($client->getCollectionName())) return;

		$operation->getParam('collection')->setDefault($client->getCollectionName());
		$operation->getParam('collection')->setStatic(true);

	}
172352
private function preBindDoctrineEvent() : void
    {
        if(EventScheduler::instance()->has(Event::DATA_CHANGED)){
            $this->getEventManager()->addEventListener([Events::postPersist, Events::postUpdate, Events::postRemove], new Class{
                public function postPersist(LifecycleEventArgs $args) : void
                {
                    EventScheduler::instance()->trigger(Event::DATA_CHANGED, ['created', $args->getEntityManager(), $args->getEntity()]);
                }

                public function postUpdate(LifecycleEventArgs $args) : void
                {
                    EventScheduler::instance()->trigger(Event::DATA_CHANGED, ['updated', $args->getEntityManager(), $args->getEntity()]);
                }

                public function postRemove(LifecycleEventArgs $args) : void
                {
                    EventScheduler::instance()->trigger(Event::DATA_CHANGED, ['deleted', $args->getEntityManager(), $args->getEntity()]);
                }
            });
        }
    }
1029698
protected function doWrite(array $event)
    {
        if (null === $this->entityRepository) {
            throw new Exception\RuntimeException('Entity repository is null');
        }

        // Transform the event into fields
        $entityClass = $this->entityRepository->getClassName();
        $entity = new $entityClass();
        $entity = $this->populateEntityFromEvent($event, $entity);
        $this->entityManager->persist($entity);
        $this->entityManager->flush();
    }
410632
public function beforeInsert($event)
    {
        $fields = $this->fields;
        $nowDate = gmdate($this->databaseTimeFormat);
        if (!$this->isActuallyDirty()) {
            return;
        }

        if (isset($this->fields['createdField']) && !$this->owner->isAttributeChanged($this->fields['createdField'])) {
            $this->owner->{$this->fields['createdField']} = $nowDate;
        }
        if (isset($this->fields['createdByField']) && !$this->owner->isAttributeChanged($this->fields['createdByField'])) {
            $this->owner->{$this->fields['createdByField']} = self::_getUserId();
        }

        if (isset($this->fields['modifiedField']) && !$this->owner->isAttributeChanged($this->fields['modifiedField'])) {
            $this->owner->{$this->fields['modifiedField']} = $nowDate;
        }
        if (isset($this->fields['modifiedByField']) && !$this->owner->isAttributeChanged($this->fields['modifiedByField'])) {
            $this->owner->{$this->fields['modifiedByField']} = self::_getUserId();
        }
    }
1196585
static private function bindEventListenersEvents()
    {
    	if (self::$_eventListeners && !self::$_elInstances) {
    		foreach (self::$_eventListeners as $class => $listeners) {
    			if ($listeners) foreach ($listeners as $listener) {
    				
    				$listener = self::getListener($listener);
    				
    				$events = $listener->events();
    				
    				if ($events) foreach ($events as $name => $handler) {
    					Event::on($class, $name, is_string($handler) ? [$listener, $handler] : $handler);
    				}
    			}
    		}
    	}
    }
632599
protected function _identifierFilter(Event $event) {
		if (is_array($this->_config['identifiers'])) {
			$identifier = $event->getData('entity.model');
			if (!in_array($identifier, $this->_config['identifiers'])) {
				return false;
			}
		}

		return true;
	}
36561
public function onRenderView(CollectViewParametersEvent $event): void
    {
        $view = $event->getView();
        if (!$view instanceof BlockViewInterface) {
            return;
        }

        if (!in_array($view->getContext(), $this->enabledContexts, true)) {
            return;
        }

        $flags = 0;
        if ($view->getContext() === ViewInterface::CONTEXT_API) {
            $flags = ResultSet::INCLUDE_UNKNOWN_ITEMS;
        }

        $block = $view->getBlock();
        $collections = [];
        $pagers = [];

        foreach ($block->getCollections() as $identifier => $collection) {
            // In non AJAX scenarios, we're always rendering the first page of the collection
            // as specified by offset and limit in the collection itself
            $pager = $this->pagerFactory->getPager(
                $collection,
                1,
                $this->getMaxPages($block),
                $flags
            );

            $collections[$identifier] = $pager->getCurrentPageResults();
            $pagers[$identifier] = $pager;
        }

        $event->addParameter('collections', $collections);
        $event->addParameter('pagers', $pagers);
    }
869296
public function loadClassMetadata(LoadClassMetadataEventArgs $event)
    {
        /** @var $metadata \Doctrine\ORM\Mapping\ClassMetadata */
        $metadata = $event->getClassMetadata();

        if ( ! isset($this->entityListeners[$metadata->name])) {
            return;
        }

        foreach ($this->entityListeners[$metadata->name] as $listener) {
            $metadata->addEntityListener($listener['event'], $listener['class'], $listener['method']);
        }

        unset($this->entityListeners[$metadata->name]);
    }
334143
public function execute(string $event)
    {
        foreach ($this->members as $member) {
            if ($member->getEvent() === $event) {
                $member->execute();
            }
        }
    }
453667
public function beforeApiRequestSend($event)
    {
        $request = $event->request;
        $data = $request->getData();
        $data['openid'] = $this->getOpenid();
        $request->setData($data);

        parent::beforeApiRequestSend($event);
    }
518858
private function dispatchModelEvent($action, $collection)
    {
        if (!($this->repository instanceof DocumentRepository)) {
            return;
        }
        if (!method_exists($collection, 'getId')) {
            return;
        }

        $event = new ModelEvent();
        $event->setCollectionId($collection->getId());
        $event->setActionByDispatchName($action);
        $event->setCollectionName($this->repository->getClassMetadata()->getCollection());
        $event->setCollectionClass($this->repository->getClassName());
        $event->setCollection($collection);

        $this->eventDispatcher->dispatch($action, $event);
    }
586669
protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel('adyen/event_queue_collection');
        $this->setCollection($collection);
        if (!$this->getParam($this->getVarNameSort())) {
            $collection->setOrder('event_queue_id', 'desc');
        }

        return parent::_prepareCollection();
    }
220956
function (preEventExtender) {
    if (!preEventExtender || !_.isObject(preEventExtender)) {
      var err = new Error('Please inject a valid event extender object!');
      debug(err);
      throw err;
    }
    if (this.preEventExtenders.indexOf(preEventExtender) < 0) {
      preEventExtender.useCollection(this);
      this.preEventExtenders.push(preEventExtender);
    }
  }
1097771
public function add(EntityAdded $event)
    {
        $entity = $event->getEntity();
        $collection = $event->getCollection();
        $this->deleteRelation($entity, $collection);

        $repository = $this->getParentRepository();
        $adapter = $repository->getAdapter();
        $value = $collection->parentEntity()->getId();

        Sql::createSql($adapter)
            ->insert($this->getRelationTable())
            ->set(
                [
                    "{$this->getRelatedForeignKey()}" => $entity->getId(),
                    "{$this->getForeignKey()}" => $value
                ]
            )
            ->execute();
    }
298403
public function onRenderView(CollectViewParametersEvent $event): void
    {
        $currentRequest = $this->requestStack->getCurrentRequest();
        if (!$currentRequest instanceof Request) {
            return;
        }

        $view = $event->getView();
        if (!$view instanceof BlockViewInterface || !$view->hasParameter('collection_identifier')) {
            return;
        }

        if (!in_array($view->getContext(), $this->enabledContexts, true)) {
            return;
        }

        $block = $view->getBlock();

        $collectionIdentifier = $view->getParameter('collection_identifier');

        $resultPager = $this->pagerFactory->getPager(
            $block->getCollection($collectionIdentifier),
            $currentRequest->query->getInt('page', 1),
            $this->getMaxPages($block)
        );

        $event->addParameter('collection', $resultPager->getCurrentPageResults());
        $event->addParameter('pager', $resultPager);
    }
837689
public function validateCollectionName()
    {
        if (empty($this->modelClass)) {
            $class = $this->generateClassName($this->collectionName);
            if ($this->isReservedKeyword($class)) {
                $this->addError('collectionName', "Collection '{$this->collectionName}' will generate a class which is a reserved PHP keyword.");
            }
        }
    }
1368920
public function beforeFind(Event $event, Query $query, ArrayObject $options, $primary) {
		$query->formatResults(function (CollectionInterface $results) {
			return $results->map(function ($row) {
				if (!$row instanceOf Entity) {
					return $row;
				}

				$this->decodeItems($row);
				return $row;
			});
		});
	}