php - 来自存储库的 findBy 触发内部错误但不是本地错误
问题描述
我对这个很迷茫......我不知道可能出了什么问题。
我有这段代码,它只是从一个地方查找所有消息。如您所见,该地点不能为空。
在开发模式下,我没有错误。在 prod 模式下,findBy 会触发内部错误。我确定就是这样,因为我可以进入第一个评论的 Json 返回而没有错误,但我无法到达第二个。
我也确定错误出现在 findBy 而不是存储库上,因为我试图分成两行并且 getRepository 没有错误。
if (!isset($place)) {
return new JsonResponse([
'success' => false,
'message' => "Place invalide"
]);
}
/*return new JsonResponse([
'success' => false,
'message' => "test0",
]);*/
$messages_place = $em->getRepository('AppBundle:MessagePlace')->findBy(array('idPlace' =>$place));
return new JsonResponse([
'success' => false,
'message' => "test",
]);
在我的 MessagePlace 实体中,我有
/**
* @var \AppBundle\Entity\Place
*
* @ORM\ManyToOne(targetEntity="Place")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="id_place", referencedColumnName="id")
* })
*/
private $idPlace;
我不明白为什么这段代码会在服务器上触发错误 500,但不会在 localhost 中触发。
感谢你的协助。
编辑:我的坏问题解决了,我在 MessagePlace 中有一个错字问题,我查询的是 id_image 而不是 is_image ...对不起。
解决方案
“如您所见,这个地方不能为空。” “可空”设置的 JoinColumn 默认值为 true,因此它可以为空。
推荐阅读
- c# - 使用 ssh 密钥访问 nuget 源
- google-apps-script - 进度完成后自动关闭模态
- pytorch - 有谁知道为什么 SHAP 的 Deep Explainer 在 ResNet-50 预训练模型上失败?
- javascript - 如何在 ReactJs 中添加 C++ 的图标
- database - Laravel / 数据库 - 安全
- c# - WPF:TreeViewItem 数据触发器
- node.js - 猫鼬在nodejs中更新一个文档中的多个字段
- extjs - 为什么在视图的控制器中没有触发委托方法
- postgresql - Postgres 类型转换和参数绑定冲突
- python - 如何修复 pytube 错误:“AttributeError: 'NoneType' 对象没有属性 'download'”