使用 Doctrine 2 执行原始 SQL

2022-01-16 00:00:00 sql php doctrine

我想使用 Doctrine 2 执行原始 SQL

I want to execute raw SQL using Doctrine 2

我需要截断数据库表并使用默认测试数据初始化表.

I need to truncate the database tables and initialize tables with default test data.

推荐答案

我发现答案大概是:

NativeQuery 可让您执行本机SQL,根据映射结果你的规格.这样一个描述如何的规范SQL 结果集映射到一个 Doctrine结果由 a 表示结果集映射.

A NativeQuery lets you execute native SQL, mapping the results according to your specifications. Such a specification that describes how an SQL result set is mapped to a Doctrine result is represented by a ResultSetMapping.

来源:Native SQL.

相关文章