src/Router/EasyAdminRouter.php
public function generate($entity, $action, array $parameters = [])
    {
        if (\is_object($entity)) {
            $config = $this->getEntityConfigByClass(\get_class($entity));

            // casting to string is needed because entities can use objects as primary keys
            $parameters['id'] = (string) $this->propertyAccessor->getValue($entity, 'id');
        } else {
            $config = \class_exists($entity)
                ? $this->getEntityConfigByClass($entity)
                : $this->configManager->getEntityConfig($entity);
        }

        $parameters['entity'] = $config['name'];
        $parameters['action'] = $action;

        $referer = $parameters['referer'] ?? null;

        $request = null;
        if (null !== $this->requestStack) {
            $request = $this->requestStack->getCurrentRequest();
        }

        if (false === $referer) {
            unset($parameters['referer']);
        } elseif (
            $request
            && !\is_string($referer)
            && (true === $referer || \in_array($action, ['new', 'edit', 'delete'], true))
        ) {
            $parameters['referer'] = \urlencode($request->getUri());
        }

        return $this->urlGenerator->generate('easyadmin', $parameters);
    }
public function generate($entity, $action, array $parameters = [])
    {
        if (\is_object($entity)) {
            $config = $this->getEntityConfigByClass(\get_class($entity));

            // casting to string is needed because entities can use objects as primary keys
            $parameters['id'] = (string) $this->propertyAccessor->getValue($entity, 'id');
        } else {
            $config = \class_exists($entity)
                ? $this->getEntityConfigByClass($entity)
                : $this->configManager->getEntityConfig($entity);
        }

        $parameters['entity'] = $config['name'];
        $parameters['action'] = $action;

        $referer = $parameters['referer'] ?? null;

        $request = null;
        if (null !== $this->requestStack) {
            $request = $this->requestStack->getCurrentRequest();
        }

        if (false === $referer) {
            unset($parameters['referer']);
        } elseif (
            $request
            && !\is_string($referer)
            && (true === $referer || \in_array($action, ['new', 'edit', 'delete'], true))
        ) {
            $parameters['referer'] = \urlencode($request->getUri());
        }

        return $this->urlGenerator->generate('easyadmin', $parameters);
    }
@param object|string $entity
@param string        $action
@param array         $parameters

@throws UndefinedEntityException

@return string