- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在做 symfony2 项目,我遇到了这个异常。有人知道是什么原因造成的吗?未捕获异常“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”,消息为“找不到 Gmjob\ExaminationBundle\Entity\Examination 对象”。在/data/apache/www/emploipublic-sf/vendor/sensio/framework-extra bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php:55\nStack
public function apply(Request $request, ConfigurationInterface $configuration)
{
$name = $configuration->getName();
$class = $configuration->getClass();
$options = $this->getOptions($configuration);
// find by identifier?
if (false === $object = $this->find($class, $request, $options, $name)) {
// find by criteria
if (false === $object = $this->findOneBy($class, $request, $options)) {
if ($configuration->isOptional()) {
$object = null;
} else {
throw new \LogicException('Unable to guess how to get a Doctrine instance from the request information.');
}
}
}
if (null === $object && false === $configuration->isOptional()) {
throw new NotFoundHttpException(sprintf('%s object not found.', $class)); // this is line 55
}
$request->attributes->set($name, $object);
return true;
}
这里是抛出异常的堆栈跟踪:
[2014 年 9 月 9 日星期二 16:56:03] [错误] [客户端 217.89.107.38] PHP fatal error :未捕获的异常 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' 消息为 'Gmjob\ExaminationBundle\Entity\Examination找不到对象。在/data/apache/www/emploipublic-sf/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php:55\n堆栈跟踪:\n
#0/data/apache/www/emploipublic-sf/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/ParamConverterManager.php(92):Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter->应用(对象(Symfony\Component\HttpFoundation\Request),对象(Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter))\n
#1/data/apache/www/emploipublic-sf/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/ParamConverterManager.php(48):Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager->applyConverter(对象(Symfony\Component\HttpFoundation\Request), 对象(Sens in/data/apache/www/emploipublic-sf/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php 第55行
最佳答案
您的问题不在 DoctrineParamConverter
中,而是在您的 Controller 中。
Param Converters 是转换参数的组件(好吧,我知道,名字告诉它但是......)。当你写的时候:
public function myAction(Request $request)
参数转换器将为您提供 Request
对象。
当你写的时候:
public function myAction(MyEntityClass $object)
然后 DoctrineParamConverter
将尝试找到与您的路由参数匹配的 Doctrine 实体。
我推荐this article来自 Symfony 的文档。
关于php - Symfony\组件\HttpKernel\异常\NotFoundHttpException : object not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26031985/
我无法在 Laravel 中处理 NotFoundHttpException 我已经尝试通过 处理它渲染()在 Handler.php 中 // Handler.php // render() ===
我尝试使用 FTP 上传我的 Laravel 项目,我进行了 composer 更新并将服务器的 PHP 版本更改为 7。但我收到“NotFoundHttpException”错误。有人可以帮助我吗?
我的 Laravel 4 应用程序日志有时会显示 NotFoundHttpException: exception 'Symfony\Component\HttpKernel\Exception\No
当我的 Symfony2 应用程序中发生不良情况时,我希望收到警报。现在我只是在日志中查找ERROR。不幸的是,“HTTP 404 - 文件未找到”(NotFoundHttpException) 被记
我想更新个人资料照片并且我正在使用 Laravel。执行此操作时,出现错误...抱歉英语不好。 我包含了路由、ProfileController、admin.blade.php、profile.bla
我使用 vue.js 和 Laravel 5.1 创建了一个小型文件共享应用程序。 一切都很完美,但现在我想确保每个文件的所有者能够从他的文件中删除用户(当然,他首先必须与这些用户共享文件),因此我向
我对这条路线有疑问。 Route::get('va/{$uniqueid}','AdminController@VaShow')->name('va'); 在 Controller 中: publ
我是 laravel 的新手。我正在尝试链接到另一个页面。我有页面索引,想转到 desc,它显示有关在索引页面中选择的车辆的信息。问题是它显示错误: Symfony \ Component \ Htt
我正在使用 Symfony3 进行开发,现在我的问题是在尝试访问“http://localhost:8000/auth 页面”时出现“404 错误” 开发日志 [2016-04-18 18:30:14
我尝试将 nginx 配置为动态处理对 laravel 应用程序的所有/{{app}}/query 请求,如下所示: server { listen 80; server_
我所有注册的路线都在工作。它们显示 View ,但在每次请求时,我的日志文件中都会显示 NotFoundHttpException。 我正在使用 NGINX。可能是我的 NGINX 配置吗? 记录在每
我正在尝试将用户重定向到自定义 404 页面,以防 Laravel 5.4 中出现 NotFoundHttpException 为此,我在 App\Exceptions\Handler.php 文件中
我在 symfony2 日志中收到了很多 NotFoundHttpException 和 AccessDeniedExceptions。我如何将这些移动到另一个文件(而不是与我机器上的所有其他日志混合
我刚刚安装了Lumen在 Windows 上,不幸的是我收到以下错误: NotFoundHttpException in Application.php line 1093: in Applicati
我收到此错误消息: Controller.php 第 269 行中的 NotFoundHttpException:找不到 Controller 方法。 谁能帮我解决这个错误信息?这是与错误消息相关的所
我正在寻找解决方案……它变得如此令人沮丧。通过 Laravel 全新安装 Lumen 后,我根本无法访问“/”路由。当我尝试时,它会抛出一个错误: NotFoundHttpException in R
我正在使用 SentryBundle 将 Sentry 集成到我的 Symfony 应用程序中。 我不想记录“NotFoundExceptions”,所以我这样配置了包: sentry: ds
我正在 Laravel 8 中开发 API。我想将 NotFoundHttpException 处理为 json 响应。但是 App\Exception\Handler 在 Laravel 8 中更新
我正在尝试为使用 Laravel 5.1.40 (LTS)、php 5.6.28 和 phpunit 4.8.27 的项目设置 phpunit 测试。如果这个问题之前已经解决了,我很抱歉,但我找不到任
我在使用 Laravel 4 进行测试时遇到了一件非常奇怪的事情。它看起来像是一个错误,但可能有一个合乎逻辑的解释。 我已经在干净的 Laravel 安装中复制了“错误”,这是我的代码: 我的资源 C
我是一名优秀的程序员,十分优秀!