什么是DQL findBy()
查询语法? ();} getDoctrine() - > getRepository(“AppBundle:Users”) - > findBy($ queryWhere);DQL findBy默认查询
1
A
回答
0
这将为WHERE子句
$repository->findBy(['email' => '[email protected]', 'city' => 'Berlin'])
SELECT * FROM table WHERE email = "[email protected]" AND city = "Berlin"
如果你有兴趣,你可以看看标准在方法getSelectSQL
下面的链接
0
这通常与实体的属性一起使用。它使用一个数组作为实体的属性名称和值作为您要搜索的值。
例子:
$this->getDoctrine()
->getRepository('AppBundle:Users')
->findBy(['id' => $id])
;
$this->getDoctrine()
->getRepository('AppBundle:Users')
->findBy(['userName' => $userName])
;
$this->getDoctrine()
->getRepository('AppBundle:Users')
->findBy(['email' => $email])
;
你可以阅读更多关于它在这里:https://symfony.com/doc/current/doctrine.html#fetching-objects-from-the-database
+0
Tnx但我想知道什么是dql语法像'select u from ...' –
相关问题
- 1. Documentum查询-DQL
- 2. DQL查询从
- 3. DQL查询失败
- 4. Mongoose默认范围查询
- 5. DQL查询 - 右键加入
- 6. 带关联的DQL查询?
- 7. 如何结合DQL查询
- 8. 在查询生成器Dql
- 9. DQL原则查询翻译
- 10. Sqlite选择查询 - 返回默认行?
- 11. LINQ to Entites 4.0查询默认编译?
- 12. SQL从表中查询默认值
- 13. Birt设置参数默认SQL查询
- 14. Hibernate:设置默认查询超时?
- 15. 传递默认值到SSRS查询
- 16. 查询默认域控制器OU LDAP
- 17. teradata默认数据库查询
- 18. 在django中修改默认查询集
- 19. solr默认查询*:*不是woking
- 20. MySQL的查询日期时间默认
- 21. 实体框架查询本地默认
- 22. 查询嵌套数组或默认
- 23. 查询改变列的默认值
- 24. 为SQL查询设置默认模式
- 25. 在LINQ查询中的默认值
- 26. 这个DQL查询是否正确?
- 27. Doctrine 2带类名的DQL查询?
- 28. DQL查询,MAX功能和getSingleResult
- 29. doctrine2 DQL子查询1行限制
- 30. 设置一个变量为DQL查询
感谢您的回答 –