[英]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文档的直接链接
getResult()
doctrine API docs getResult()
doctrine API文档 getSingleResult()
doctrine API docs getSingleResult()
doctrine API文档 getSingleScalarResult()
doctrine API docs getSingleScalarResult()
doctrine API docs getOneOrNullResult()
doctrine API docs getOneOrNullResult()
doctrine API docs Also important exceptions: 同样重要的例外:
NoResultException
doctrine API docs NoResultException
doctrine API文档 NonUniqueResultException
doctrine API docs NonUniqueResultException
doctrine API文档 (must handle for getSingle*()
and getOneOrNullResult()
methods) (必须处理getSingle*()
和getOneOrNullResult()
方法)
UnexpectedResultException
doctrine API docs (this is parent exception of the two above) UnexpectedResultException
doctrine API docs (这是上面两个的父异常) 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.