[英]Is Doctrine persist() safe from SQL injection?
I am wondering if the function persist()
from Doctrine is safe to prevent SQL injection. 我想知道Doctrine中的函数
persist()
是否可以安全地防止SQL注入。 I have searched, but after reading for a while, it still isn't clear to me. 我已经搜索过了,但是看了一段时间之后,对我来说仍然不清楚。 I am using Symfony 2:
我正在使用Symfony 2:
$em = $this->getDoctrine()->getManager();
$em->persist($log);
$em->flush();
You can find answer to your question in Doctrine 2 documentation - here 您可以在教义2文档中找到问题的答案- 在此处
You can consider the following APIs to be safe from SQL injection ... All values on Objects inserted and updated through
Doctrine\\ORM\\EntityManager#persist()
您可以认为以下API可以防止SQL注入...通过
Doctrine\\ORM\\EntityManager#persist()
插入和更新的对象上的所有值
So yes, persist
should be safe from SQL injection. 因此,是的,
persist
应该免受SQL注入的影响。
是的,ORM会生成SQL并自动为您进行查询的实用化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.