src/Middleware/SubstituteBindings.php
protected function substituteImplicitBindings(Route $route)
    {
        $parameters = $route->parameters();

        foreach ($this->signatureParameters($route) as $parameter) {
            $id    = $parameters[$parameter->name];
            $class = $parameter->getClass()->getName();

            if ($repository = $this->registry->getRepository($class)) {
                if ($parameter->getClass()->implementsInterface(UrlRoutable::class)) {
                    $name = call_user_func([$class, 'getRouteKeyName']);

                    $entity = $repository->findOneBy([
                        $name => $id
                    ]);
                } else {
                    $entity = $repository->find($id);
                }

                if (is_null($entity) && !$parameter->isDefaultValueAvailable()) {
                    throw EntityNotFoundException::fromClassNameAndIdentifier($class, ['id' => $id]);
                }

                $route->setParameter($parameter->name, $entity);
            }
        }
    }
protected function substituteImplicitBindings(Route $route)
    {
        $parameters = $route->parameters();

        foreach ($this->signatureParameters($route) as $parameter) {
            $id    = $parameters[$parameter->name];
            $class = $parameter->getClass()->getName();

            if ($repository = $this->registry->getRepository($class)) {
                if ($parameter->getClass()->implementsInterface(UrlRoutable::class)) {
                    $name = call_user_func([$class, 'getRouteKeyName']);

                    $entity = $repository->findOneBy([
                        $name => $id
                    ]);
                } else {
                    $entity = $repository->find($id);
                }

                if (is_null($entity) && !$parameter->isDefaultValueAvailable()) {
                    throw EntityNotFoundException::fromClassNameAndIdentifier($class, ['id' => $id]);
                }

                $route->setParameter($parameter->name, $entity);
            }
        }
    }
protected function substituteImplicitBindings ( Route $ route ) { $ parameters = $ route -> parameters ( ) ; foreach ( $ this -> signatureParameters ( $ route ) as $ parameter ) { $ id = $ parameters [ $ parameter -> name ] ; $ class = $ parameter -> getClass ( ) -> getName ( ) ; if ( $ repository = $ this -> registry -> getRepository ( $ class ) ) { if ( $ parameter -> getClass ( ) -> implementsInterface ( UrlRoutable :: class ) ) { $ name = call_user_func ( [ $ class , 'getRouteKeyName' ] ) ; $ entity = $ repository -> findOneBy ( [ $ name => $ id ] ) ; } else { $ entity = $ repository -> find ( $ id ) ; } if ( is_null ( $ entity ) && ! $ parameter -> isDefaultValueAvailable ( ) ) { throw EntityNotFoundException :: fromClassNameAndIdentifier ( $ class , [ 'id' => $ id ] ) ; } $ route -> setParameter ( $ parameter -> name , $ entity ) ; } } }
Substitute the implicit Doctrine entity bindings for the route.

@param Route $route

@throws EntityNotFoundException
Substitute the implicit Doctrine entity bindings for the route .