mic*_*jnr 4 mysql doctrine symfony doctrine-orm
我正在尝试使用URL中的两个项目检索内容.这是应该执行的php/symfony代码:
$em = $this->getDoctrine()->getEntityManager();
$repository = $this->getDoctrine()
->getRepository('ShoutMainBundle:Content');
$query = $repository->createQueryBuilder('p')
->where('p.slug > :slug')
->andWhere('p.subtocontentid > :parent')
->setParameters(array(
'slug' => $slug,
'parent' => $page
))
->getQuery();
$content = $query->getSingleResult();
Run Code Online (Sandbox Code Playgroud)
但是,执行此代码时,它返回以下错误:
虽然预计至少有一行,但未找到查询结果.
我做了一些测试,$slug并且$page变量中保存的数据保存了正确的信息.我还测试了MySQL查询,查询提出了所需的结果,这让我更加困惑.
我错过了什么吗?
| 归档时间: |
|
| 查看次数: |
9319 次 |
| 最近记录: |