Определение entryId на основе параметров роута

@param ResolveEntryIdEventInterface $event

@return integer|null

@throws Exception\InvalidMetadataException
425294
public function onResolveEntryIdHandler(ResolveEntryIdEventInterface $event)
    {
        $this->getLog()->info('Getting the value "entryId" to run the Workflow based on the router settings');

        $mvcEvent = $event->getWorkflowDispatchEvent()->getMvcEvent();
        $controller = $mvcEvent->getTarget();
        if (!$controller instanceof AbstractController) {
            $this->getLog()->notice(
                'Unable to get the value of "entryId" to start the workflow. No controller object in the property "target" MvcEvent.'
            );
            return null;
        }

        $routeMatch = $mvcEvent->getRouteMatch();
        if (!$routeMatch) {
            return null;
        }

        $action = $routeMatch->getParam('action', 'not-found');
        $actionMethod = AbstractController::getMethodFromAction($action);

        if (!method_exists($controller, $actionMethod)) {
            $this->getLog()->notice(
                'Unable to get the value of "entryId" to start the workflow. Do not set RouteMatch'
            );
            return null;
        }

        $controllerClassName = get_class($controller);
        $metadata = $this->getMetadataReader()->loadMetadataForAction($controllerClassName, $actionMethod);

        if (!$metadata instanceof MetadataInterface) {
            $errMsg = sprintf('Metadata not implement %s', MetadataInterface::class);
            throw new Exception\InvalidMetadataException($errMsg);
        }

        $entryIdParam = $metadata->getEntryIdRouterParam();
        $entryId = $routeMatch->getParam($entryIdParam, null);

        $this->getLog()->info(
            'Meaning "entryId" to run the Workflow based on the router settings',
            [
                'entryId' => $entryId
            ]
        );

        return $entryId;
    }
1193587
public function entry($identity)
	{
		if ( ! isset($this->info['entries']))
		{
			return null;
		}

		$entries = $this->info['entries'];
		foreach ($entries as $entry)
		{
			// try the name
			if ($entry->playerOrTeamName == $identity)
			{
				return $entry;
			}
			// try the id
			if ($entry->playerOrTeamId == $identity)
			{
				return $entry;
			}
		}

		return null;
	}
961076
public function has(string $entryIdentifier): bool
    {
        if ($this->frozen === true) {
            return isset($this->cacheEntryIdentifiers[$entryIdentifier]);
        }
        if ($entryIdentifier !== basename($entryIdentifier)) {
            throw new \InvalidArgumentException('The specified entry identifier must not contain a path segment.', 1282073034);
        }
        return !$this->isCacheFileExpired($this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension);
    }
854795
protected function extractMetadata($entryIdentifier, $content)
    {
        $separatorIndex = strpos($content, self::SEPARATOR);
        if ($separatorIndex === false) {
            $exception = new InvalidDataTypeException('Could not find cache metadata in entry with identifier ' . $entryIdentifier, 1433155925);
            if ($this->environment->getContext()->isProduction()) {
                $this->logger->logException($exception);
            } else {
                throw $exception;
            }
        }

        $metadataJson = substr($content, 0, $separatorIndex);
        $metadata = json_decode($metadataJson, true);
        if ($metadata === null) {
            $exception = new InvalidDataTypeException('Invalid cache metadata in entry with identifier ' . $entryIdentifier, 1433155926);
            if ($this->environment->getContext()->isProduction()) {
                $this->logger->logException($exception);
            } else {
                throw $exception;
            }
        }

        $this->metadata[$entryIdentifier] = $metadata;

        return substr($content, $separatorIndex + 1);
    }
697766
@Override
    public InputSource resolveEntity(String publicId, String systemId) {
	for (int i = 0; i < Constants.DTDS_FLD.length; i++) {
	    if (publicId.equals(Constants.DTDS_FLD[i])) {
		return new InputSource(getClass().getResourceAsStream(DTD_1_0));
	    }
	}
	return null;
    }
700596
protected function _getIdentifier(\Zend_EventManager_EventDescription $event)
    {
        $params = $event->getParams();
        if(!isset($params['id'])) {
            throw new \Zend_EventManager_Exception_InvalidArgumentException('Missing param id.');
        }

        return md5($this->_getClassName($event->getTarget()) . '-' . $params['id']);
    }
1366576
public function resolveEntryNameByContext($entryName, $context = null)
    {
        if (!interface_exists($entryName) && !class_exists($entryName)) {
            return null;
        }

        if (null === $context) {
            return $entryName;
        }

        $contextClass = $this->buildClassNameContext($context);
        $className = $this->buildClassNameByEntryName($entryName);

        $resolveByContext = $this->resolve($className, $contextClass);
        if (null !== $resolveByContext) {
            return $resolveByContext;
        }

        return $this->resolve($className, $className);
    }
1275114
@Override
    public void metadataResolved(RepositoryEvent event) {
        log.fine("Resolved metadata " + event.getMetadata() + " from " + event.getRepository());
    }
335756
public function get(EventInterface $event) {
        $response = $event->getResponse();
        $response->setMaxAge(0)
                 ->setPrivate();

        $response->headers->addCacheControlDirective('no-store');

        $event->getManager()->trigger('db.stats.load');
    }
94247
public function onMoveContent(EventInterface $event)
    {
        $translator = $this->getTranslator();
        $mapper = $this->getLayoutMapper();
        if (is_null($event->getParam('tid'))) {
            throw new InvalidArgumentException(
                $translator->translate(
                    "Unknown transaction identifier. Missing event param 'tid'."
                )
            );
        }
        if (is_null($event->getParam('content'))) {
            throw new InvalidArgumentException(sprintf(
                $translator->translate(
                    "Missing event param '%s'."
                ),
                'content'
            ));
        }
        $mapper->unregisterContent(
            $event->getParam('content'),
            false,
            $event->getParam('tid')
        );
    }
719518
private function checkExpression($entryId, FieldExpression $expression)
    {
        $value = $expression->getValue();
        $operator = $expression->getOperator();
        $field = $expression->getField();
        $context = $expression->getContext();

        $id = (integer)$entryId;

        if ($context === FieldExpression::ENTRY) {
            $theEntry = static::$entryCache[$id];

            if ($field === FieldExpression::NAME) {
                return $this->compareText($theEntry->getWorkflowName(), $value, $operator);
            }

            if ($field === FieldExpression::STATE) {
                if (!is_numeric($value)) {
                    $errMsg = 'unknown field';
                    throw new InvalidArgumentException($errMsg);
                }

                $valueInt = (integer)$value;

                return $this->compareLong($valueInt, $theEntry->getState(), $operator);
            }

            $errMsg = 'unknown field';
            throw new InvalidArgumentException($errMsg);
        }

        /** @var SplObjectStorage[]|SimpleStep[] $steps */
        $steps = [];

        if ($context === FieldExpression::CURRENT_STEPS) {
            $steps = array_key_exists($id, static::$currentStepsCache) ? static::$currentStepsCache[$id] : $steps;
        } elseif ($context === FieldExpression::HISTORY_STEPS) {
            $steps = array_key_exists($id, static::$historyStepsCache) ? static::$historyStepsCache[$id] : $steps;
        } else {
            $errMsg = 'unknown field context';
            throw new InvalidArgumentException($errMsg);
        }

        if (0 === count($steps)) {
            return false;
        }

        $expressionResult = false;

        switch ($field) {
            case FieldExpression::ACTION:
                if (!is_numeric($value)) {
                    $errMsg = 'unknown field';
                    throw new InvalidArgumentException($errMsg);
                }

                $actionId = (integer)$value;

                foreach ($steps as $step) {
                    if ($this->compareLong($step->getActionId(), $actionId, $operator)) {
                        $expressionResult = true;

                        break;
                    }
                }


                break;

            case FieldExpression::CALLER:
                $caller = $value;
                if ('string' !== gettype($caller)) {
                    $errMsg = 'unknown field';
                    throw new InvalidArgumentException($errMsg);
                }

                foreach ($steps as $step) {
                    if ($this->compareText($step->getCaller(), $caller, $operator)) {
                        $expressionResult = true;

                        break;
                    }
                }

                break;

            case FieldExpression::FINISH_DATE:
                if ($value instanceof DateTime) {
                    $finishDate = $value;
                    foreach ($steps as $step) {
                        if ($this->compareDate($step->getFinishDate(), $finishDate, $operator)) {
                            $expressionResult = true;

                            break;
                        }
                    }
                } else {
                    $errMsg = 'unknown field';
                    throw new InvalidArgumentException($errMsg);
                }

                break;

            case FieldExpression::OWNER:
                $owner = $value;
                if ('string' !== gettype($owner)) {
                    $errMsg = 'unknown field';
                    throw new InvalidArgumentException($errMsg);
                }

                foreach ($steps as $step) {
                    if ($this->compareText($step->getOwner(), $owner, $operator)) {
                        $expressionResult = true;

                        break;
                    }
                }


                break;

            case FieldExpression::START_DATE:
                if ($value instanceof DateTime) {
                    $startDate = $value;
                    foreach ($steps as $step) {
                        if ($this->compareDate($step->getStartDate(), $startDate, $operator)) {
                            $expressionResult = true;

                            break;
                        }
                    }
                } else {
                    $errMsg = 'unknown field';
                    throw new InvalidArgumentException($errMsg);
                }

                break;

            case FieldExpression::STEP:
                if (!is_numeric($value)) {
                    $errMsg = 'unknown field';
                    throw new InvalidArgumentException($errMsg);
                }
                $stepId = (integer)$value;

                foreach ($steps as $step) {
                    if ($this->compareLong($step->getStepId(), $stepId, $operator)) {
                        $expressionResult = true;

                        break;
                    }
                }

                break;

            case FieldExpression::STATUS:
                $status = $value;
                if ('string' !== gettype($status)) {
                    $errMsg = 'unknown field';
                    throw new InvalidArgumentException($errMsg);
                }

                foreach ($steps as $step) {
                    if ($this->compareText($step->getStatus(), $status, $operator)) {
                        $expressionResult = true;

                        break;
                    }
                }

                break;

            case FieldExpression::DUE_DATE:
                if ($value instanceof DateTime) {
                    $dueDate = $value;
                    foreach ($steps as $step) {
                        if ($this->compareDate($step->getDueDate(), $dueDate, $operator)) {
                            $expressionResult = true;

                            break;
                        }
                    }
                } else {
                    $errMsg = 'unknown field';
                    throw new InvalidArgumentException($errMsg);
                }


                break;
        }

        if ($expression->isNegate()) {
            return !$expressionResult;
        } else {
            return $expressionResult;
        }
    }
397885
protected function getEventLogInfo(Event $event, $eventName)
    {
        if ($event instanceof EmbeddedEventResolverInterface) {
            return $event->getEventLogInfo($eventName);
        }

        if (null === $eventResolver = $this->getResolver($eventName)) {
            return null;
        }

        return $eventResolver->getEventLogInfo($event, $eventName);
    }
980009
public function getField($key)
    {
        $resolved = $this->getResolved();
        if (!$resolved instanceof EntryInterface) {
            return null;
        }

        return $resolved->getField($key);
    }
1109026
private function guardValidIdentifier($identifier)
    {
        if (null === $identifier || '' === $identifier) {
            throw new ResolveComponentDataException('No resolved identifier given');
        }

        if (!is_scalar($identifier) && !is_array($identifier)) {
            throw new ResolveComponentDataException('Identifier has to be a scalar or an array');
        }
    }
30257
protected function publish(EntryInterface $entry)
    {
        $requestor = $this->getRequestor($entry);
        
        return $requestor->doRequest($entry->getRequest());
    }
1205554
protected function sqlentry($entry_id) {
		$res = $this->sqlfind([ $this->idfield() => $entry_id ], null, null, 1);
		if (empty($res)) {
			return null;
		}
		else { // found entry
			return $res[0];
		}
	}
555468
public function get(string $entryIdentifier)
    {
        return $this->uncompress($this->redis->get($this->buildKey('entry:' . $entryIdentifier)));
    }