1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/lib/Doctrine/ORM/NativeQuery.php

56 lines
1.0 KiB
PHP
Raw Normal View History

2008-09-12 16:28:36 +04:00
<?php
namespace Doctrine\ORM;
2008-09-12 16:28:36 +04:00
/**
* Represents a native SQL query.
*
* @since 2.0
2008-09-12 16:28:36 +04:00
*/
class NativeQuery
2008-09-12 16:28:36 +04:00
{
private $_sql;
private $_conn;
private $_params = array();
public function __construct($sql, Connection $conn)
{
2008-09-12 16:28:36 +04:00
$this->_sql = $sql;
$this->_conn = $conn;
}
/*public function addScalar()
{
}*/
public function addEntity($alias, $className)
{
$this->_entities[$alias] = $className;
}
public function addJoin($join)
{
}
public function setParameter($key, $value)
{
$this->_params[$key] = $value;
}
public function execute(array $params)
{
if ($this->_entities) {
//...
} else {
return $this->_conn->execute($this->_sql, array_merge($this->_params, $params));
}
}
public function executeUpdate(array $params)
{
return $this->_conn->exec($this->_sql, array_merge($this->_params, $params));
}
}