APIGILITY + Doctrine:找不到实体 = "No result was found for query although at least one row was expected"
APIGILITY + Doctrine: cannot find entities = "No result was found for query although at least one row was expected"
我有一个服务,与学说相关,完全由 Apigility 创建,没有任何修改。代码从未被修改,它就像 Apigility 创建它一样工作。
请求 collection 时:
myapi.local/path
{
"count": 25,
"total": 13562,
"collectionTotal": 13562,
"_links":
{ ... more stuff here
},
"_embedded":
{
"path":
[
{
"pathid": 1,
"dev": 51729,
"inode": "2",
"path": "/disk1",
"online": true,
"fileid": "0",
"_links":
{
"self":
{
"href": "http://imageadministration.local/path/1"
}
}
},
... and so on
当请求完全相同的实体 myapi 时。local/path/1:
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Not Found",
"status": 404,
"detail": "Entity was not found"
}
响应headers:
Status Code: 404 Not Found
Access-Control-Allow-Headers: Authorization, Origin, Content-Type, Accept
Access-Control-Allow-Methods: PUT, GET, POST, PATCH, DELETE
Connection: Keep-Alive
Content-Type: application/problem+json
Date: Fri, 08 Apr 2016 08:40:35 GMT
Keep-Alive: timeout=5, max=100
Server: Apache/2.4.10 (Debian)
Transfer-Encoding: chunked
X-Powered-By: PHP/5.6.17
access-control-allow-origin: *
一步步调试代码,找到一个"No result was found for query although at least one row was expected"。此消息在 Doctrine object 中并且永远不会返回给用户。没有 PHP 错误,没有异常,什么都没有。实际上,可以在数据库中使用简单的 select 找到注册表。
错误消息本身在其他 中有解释,但是由于此服务 100% 由 Apigility 创建,并且异常发生在 Doctrine 模块内部,并且没有一行我自己的代码,我什至不知道从哪里开始。实体没有关系,它是由 Doctrine 通过 orm-module 自动创建的。
任何方向将不胜感激,czr。
已解决:这恰好是 üäö 的一个非常奇怪的编码错误。移除后,它恢复正常。不幸的是仍然不知道为什么。
我有一个服务,与学说相关,完全由 Apigility 创建,没有任何修改。代码从未被修改,它就像 Apigility 创建它一样工作。
请求 collection 时: myapi.local/path
{
"count": 25,
"total": 13562,
"collectionTotal": 13562,
"_links":
{ ... more stuff here
},
"_embedded":
{
"path":
[
{
"pathid": 1,
"dev": 51729,
"inode": "2",
"path": "/disk1",
"online": true,
"fileid": "0",
"_links":
{
"self":
{
"href": "http://imageadministration.local/path/1"
}
}
},
... and so on
当请求完全相同的实体 myapi 时。local/path/1:
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Not Found",
"status": 404,
"detail": "Entity was not found"
}
响应headers:
Status Code: 404 Not Found
Access-Control-Allow-Headers: Authorization, Origin, Content-Type, Accept
Access-Control-Allow-Methods: PUT, GET, POST, PATCH, DELETE
Connection: Keep-Alive
Content-Type: application/problem+json
Date: Fri, 08 Apr 2016 08:40:35 GMT
Keep-Alive: timeout=5, max=100
Server: Apache/2.4.10 (Debian)
Transfer-Encoding: chunked
X-Powered-By: PHP/5.6.17
access-control-allow-origin: *
一步步调试代码,找到一个"No result was found for query although at least one row was expected"。此消息在 Doctrine object 中并且永远不会返回给用户。没有 PHP 错误,没有异常,什么都没有。实际上,可以在数据库中使用简单的 select 找到注册表。
错误消息本身在其他
任何方向将不胜感激,czr。
已解决:这恰好是 üäö 的一个非常奇怪的编码错误。移除后,它恢复正常。不幸的是仍然不知道为什么。