开发者

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

开发者 https://www.devze.com 2023-02-06 17:17 出处:网络
I wonder what 开发者_StackOverflowis returned by functions like get*Result(). It seems like null? Where in the docs can I find such info?get*Result() methods return an empty array()

I wonder what 开发者_StackOverflowis returned by functions like get*Result(). It seems like null? Where in the docs can I find such info?


get*Result() methods return an empty array()
getSingle*Result() methods throw a \Doctrine\ORM\NoResultException

Here are direct links to the doctrine API docs

  • getResult() doctrine API docs
  • getSingleResult() doctrine API docs
  • getSingleScalarResult() doctrine API docs
  • getOneOrNullResult() doctrine API docs

Also important exceptions:

  • NoResultException doctrine API docs
  • NonUniqueResultException doctrine API docs

    (must handle for getSingle*() and getOneOrNullResult() methods)

  • UnexpectedResultException doctrine API docs (this is parent exception of the two above)

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号