. */ namespace Doctrine\ORM; /** * Represents a native SQL query. * * @author Roman Borschel * @since 2.0 */ final class NativeQuery extends AbstractQuery { private $_sql; /** * Initializes a new instance of the NativeQuery class that is bound * to the given EntityManager. * * @param EntityManager $em */ public function __construct(EntityManager $em) { parent::__construct($em); } /** * Sets the SQL of the query. * * @param string $sql */ public function setSql($sql) { $this->_sql = $sql; } /** * Gets the SQL query. * * @return mixed The built SQL query or an array of all SQL queries. * @override */ public function getSql() { return $this->_sql; } /** * Executes the query. * * @param array $params * @return Statement The Statement handle. * @override */ protected function _doExecute(array $params) { return $this->_em->getConnection()->execute($this->_sql, $this->_prepareParams($params)); } }