简体   繁体   English

学说2:当没有行时,getResult会返回什么? 空值?

[英]Doctrine 2: What does getResult return when there are no rows? null?

I wonder what is returned by functions like get*Result() . 我想知道get*Result()等函数返回了什么。 It seems like null? 好像是空的? Where in the docs can I find such info? 我可以在文档中找到这样的信息吗?

get*Result() methods return an empty array() get*Result()方法返回一个空array()
getSingle*Result() methods throw a \\Doctrine\\ORM\\NoResultException getSingle*Result()方法抛出\\Doctrine\\ORM\\NoResultException

Here are direct links to the doctrine API docs 以下是doctrine API文档的直接链接

Also important exceptions: 同样重要的例外:

direct links are for 2.6, but you can find there more recent versions at the at http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/index.html 直接链接适用于2.6,但您可以在http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/index.html找到更多最新版本。

只需使用var_dump(),您就可以看到函数返回的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM