Commit 103cdf57 authored by guilhermeblanco's avatar guilhermeblanco

[2.0] More docblocks. Renamed methods Type::addCustomType to Type::addType and...

[2.0] More docblocks. Renamed methods Type::addCustomType to Type::addType and Connection::exec to Connection::executeUpdate. Added Type::hasType.
parent aee14e31
...@@ -26,8 +26,14 @@ use Doctrine\DBAL\Types\Type; ...@@ -26,8 +26,14 @@ use Doctrine\DBAL\Types\Type;
/** /**
* Configuration container for the Doctrine DBAL. * Configuration container for the Doctrine DBAL.
* *
* @author Roman Borschel <roman@code-factory.org> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 2.0 * @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*
* @internal When adding a new configuration option just write a getter/setter * @internal When adding a new configuration option just write a getter/setter
* pair and add the option to the _attributes array with a proper default value. * pair and add the option to the _attributes array with a proper default value.
*/ */
...@@ -43,6 +49,7 @@ class Configuration ...@@ -43,6 +49,7 @@ class Configuration
/** /**
* Creates a new configuration that can be used for Doctrine. * Creates a new configuration that can be used for Doctrine.
*
*/ */
public function __construct() public function __construct()
{ {
...@@ -71,13 +78,28 @@ class Configuration ...@@ -71,13 +78,28 @@ class Configuration
return $this->_attributes['sqlLogger']; return $this->_attributes['sqlLogger'];
} }
public function setCustomTypes(array $types) /**
* Defines new custom types to be supported by Doctrine
*
* @param array $types Key-value map of types to include
* @param boolean $override Optional flag to support only inclusion or also override
* @throws DoctrineException
*/
public function setCustomTypes(array $types, $override = false)
{ {
foreach ($types as $name => $typeClassName) { foreach ($types as $name => $typeClassName) {
Type::addCustomType($name, $typeClassName); $method = (Type::hasType($name) ? 'override' : 'add') . 'Type';
Type::$method($name, $typeClassName);
} }
} }
/**
* Overrides existent types in Doctrine
*
* @param array $types Key-value map of types to override
* @throws DoctrineException
*/
public function setTypeOverrides(array $overrides) public function setTypeOverrides(array $overrides)
{ {
foreach ($override as $name => $typeClassName) { foreach ($override as $name => $typeClassName) {
......
<?php <?php
/* /*
* $Id: Connection.php 4933 2008-09-12 10:58:33Z romanb $ * $Id$
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
...@@ -29,12 +29,15 @@ use Doctrine\Common\DoctrineException; ...@@ -29,12 +29,15 @@ use Doctrine\Common\DoctrineException;
* events, transaction isolation levels, configuration, emulated transaction nesting, * events, transaction isolation levels, configuration, emulated transaction nesting,
* lazy connecting and more. * lazy connecting and more.
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 1.0 * @link www.doctrine-project.org
* @version $Revision: 4933 $ * @since 2.0
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @version $Revision: 3938 $
* @author Lukas Smith <smith@pooteeweet.org> (MDB2 library) * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (MDB2 library)
*/ */
class Connection class Connection
{ {
...@@ -42,14 +45,17 @@ class Connection ...@@ -42,14 +45,17 @@ class Connection
* Constant for transaction isolation level READ UNCOMMITTED. * Constant for transaction isolation level READ UNCOMMITTED.
*/ */
const TRANSACTION_READ_UNCOMMITTED = 1; const TRANSACTION_READ_UNCOMMITTED = 1;
/** /**
* Constant for transaction isolation level READ COMMITTED. * Constant for transaction isolation level READ COMMITTED.
*/ */
const TRANSACTION_READ_COMMITTED = 2; const TRANSACTION_READ_COMMITTED = 2;
/** /**
* Constant for transaction isolation level REPEATABLE READ. * Constant for transaction isolation level REPEATABLE READ.
*/ */
const TRANSACTION_REPEATABLE_READ = 3; const TRANSACTION_REPEATABLE_READ = 3;
/** /**
* Constant for transaction isolation level SERIALIZABLE. * Constant for transaction isolation level SERIALIZABLE.
*/ */
...@@ -165,6 +171,7 @@ class Connection ...@@ -165,6 +171,7 @@ class Connection
if ( ! $config) { if ( ! $config) {
$config = new Configuration(); $config = new Configuration();
} }
if ( ! $eventManager) { if ( ! $eventManager) {
$eventManager = new EventManager(); $eventManager = new EventManager();
} }
...@@ -291,7 +298,6 @@ class Connection ...@@ -291,7 +298,6 @@ class Connection
$this->_params['password'] : null; $this->_params['password'] : null;
$this->_conn = $this->_driver->connect($this->_params, $user, $password, $driverOptions); $this->_conn = $this->_driver->connect($this->_params, $user, $password, $driverOptions);
$this->_isConnected = true; $this->_isConnected = true;
return true; return true;
...@@ -366,16 +372,17 @@ class Connection ...@@ -366,16 +372,17 @@ class Connection
public function delete($tableName, array $identifier) public function delete($tableName, array $identifier)
{ {
$this->connect(); $this->connect();
$criteria = array(); $criteria = array();
foreach (array_keys($identifier) as $id) { foreach (array_keys($identifier) as $id) {
$criteria[] = $this->quoteIdentifier($id) . ' = ?'; $criteria[] = $this->quoteIdentifier($id) . ' = ?';
} }
$query = 'DELETE FROM ' $query = 'DELETE FROM ' . $this->quoteIdentifier($tableName)
. $this->quoteIdentifier($tableName) . ' WHERE ' . implode(' AND ', $criteria);
. ' WHERE ' . implode(' AND ', $criteria);
return $this->exec($query, array_values($identifier)); return $this->executeUpdate($query, array_values($identifier));
} }
/** /**
...@@ -386,6 +393,7 @@ class Connection ...@@ -386,6 +393,7 @@ class Connection
public function close() public function close()
{ {
unset($this->_conn); unset($this->_conn);
$this->_isConnected = false; $this->_isConnected = false;
} }
...@@ -397,7 +405,8 @@ class Connection ...@@ -397,7 +405,8 @@ class Connection
public function setTransactionIsolation($level) public function setTransactionIsolation($level)
{ {
$this->_transactionIsolationLevel = $level; $this->_transactionIsolationLevel = $level;
return $this->exec($this->_platform->getSetTransactionIsolationSql($level));
return $this->executeUpdate($this->_platform->getSetTransactionIsolationSql($level));
} }
/** /**
...@@ -422,11 +431,13 @@ class Connection ...@@ -422,11 +431,13 @@ class Connection
public function update($tableName, array $data, array $identifier) public function update($tableName, array $data, array $identifier)
{ {
$this->connect(); $this->connect();
if (empty($data)) { if (empty($data)) {
return false; return false;
} }
$set = array(); $set = array();
foreach ($data as $columnName => $value) { foreach ($data as $columnName => $value) {
$set[] = $this->quoteIdentifier($columnName) . ' = ?'; $set[] = $this->quoteIdentifier($columnName) . ' = ?';
} }
...@@ -434,11 +445,11 @@ class Connection ...@@ -434,11 +445,11 @@ class Connection
$params = array_merge(array_values($data), array_values($identifier)); $params = array_merge(array_values($data), array_values($identifier));
$sql = 'UPDATE ' . $this->quoteIdentifier($tableName) $sql = 'UPDATE ' . $this->quoteIdentifier($tableName)
. ' SET ' . implode(', ', $set) . ' SET ' . implode(', ', $set)
. ' WHERE ' . implode(' = ? AND ', array_keys($identifier)) . ' WHERE ' . implode(' = ? AND ', array_keys($identifier))
. ' = ?'; . ' = ?';
return $this->exec($sql, $params); return $this->executeUpdate($sql, $params);
} }
/** /**
...@@ -452,6 +463,7 @@ class Connection ...@@ -452,6 +463,7 @@ class Connection
public function insert($tableName, array $data) public function insert($tableName, array $data)
{ {
$this->connect(); $this->connect();
if (empty($data)) { if (empty($data)) {
return false; return false;
} }
...@@ -459,17 +471,17 @@ class Connection ...@@ -459,17 +471,17 @@ class Connection
// column names are specified as array keys // column names are specified as array keys
$cols = array(); $cols = array();
$a = array(); $a = array();
foreach ($data as $columnName => $value) { foreach ($data as $columnName => $value) {
$cols[] = $this->quoteIdentifier($columnName); $cols[] = $this->quoteIdentifier($columnName);
$a[] = '?'; $a[] = '?';
} }
$query = 'INSERT INTO ' . $this->quoteIdentifier($tableName) $query = 'INSERT INTO ' . $this->quoteIdentifier($tableName)
. ' (' . implode(', ', $cols) . ') ' . ' (' . implode(', ', $cols) . ')'
. 'VALUES ('; . ' VALUES (' . implode(', ', $a) . ')';
$query .= implode(', ', $a) . ')';
return $this->exec($query, array_values($data)); return $this->executeUpdate($query, array_values($data));
} }
/** /**
...@@ -479,7 +491,7 @@ class Connection ...@@ -479,7 +491,7 @@ class Connection
*/ */
public function setCharset($charset) public function setCharset($charset)
{ {
$this->exec($this->_platform->getSetCharsetSql($charset)); $this->executeUpdate($this->_platform->getSetCharsetSql($charset));
} }
/** /**
...@@ -493,8 +505,6 @@ class Connection ...@@ -493,8 +505,6 @@ class Connection
* problems than they solve. * problems than they solve.
* *
* @param string $str identifier name to be quoted * @param string $str identifier name to be quoted
* @param bool $checkOption check the 'quote_identifier' option
*
* @return string quoted identifier string * @return string quoted identifier string
*/ */
public function quoteIdentifier($str) public function quoteIdentifier($str)
...@@ -548,6 +558,7 @@ class Connection ...@@ -548,6 +558,7 @@ class Connection
public function prepare($statement) public function prepare($statement)
{ {
$this->connect(); $this->connect();
return $this->_conn->prepare($statement); return $this->_conn->prepare($statement);
} }
...@@ -565,6 +576,7 @@ class Connection ...@@ -565,6 +576,7 @@ class Connection
if ($limit > 0 || $offset > 0) { if ($limit > 0 || $offset > 0) {
$query = $this->_platform->modifyLimitQuery($query, $limit, $offset); $query = $this->_platform->modifyLimitQuery($query, $limit, $offset);
} }
return $this->execute($query); return $this->execute($query);
} }
...@@ -573,7 +585,6 @@ class Connection ...@@ -573,7 +585,6 @@ class Connection
* *
* @param string $query sql query * @param string $query sql query
* @param array $params query parameters * @param array $params query parameters
*
* @return PDOStatement * @return PDOStatement
*/ */
public function execute($query, array $params = array()) public function execute($query, array $params = array())
...@@ -590,6 +601,7 @@ class Connection ...@@ -590,6 +601,7 @@ class Connection
} else { } else {
$stmt = $this->_conn->query($query); $stmt = $this->_conn->query($query);
} }
$this->_queryCount++; $this->_queryCount++;
return $stmt; return $stmt;
...@@ -601,9 +613,8 @@ class Connection ...@@ -601,9 +613,8 @@ class Connection
* @param string $query sql query * @param string $query sql query
* @param array $params query parameters * @param array $params query parameters
* @return integer * @return integer
* @todo Rename to executeUpdate().
*/ */
public function exec($query, array $params = array()) public function executeUpdate($query, array $params = array())
{ {
$this->connect(); $this->connect();
...@@ -618,6 +629,7 @@ class Connection ...@@ -618,6 +629,7 @@ class Connection
} else { } else {
$result = $this->_conn->exec($query); $result = $this->_conn->exec($query);
} }
$this->_queryCount++; $this->_queryCount++;
return $result; return $result;
...@@ -651,6 +663,7 @@ class Connection ...@@ -651,6 +663,7 @@ class Connection
public function errorCode() public function errorCode()
{ {
$this->connect(); $this->connect();
return $this->_conn->errorCode(); return $this->_conn->errorCode();
} }
...@@ -662,6 +675,7 @@ class Connection ...@@ -662,6 +675,7 @@ class Connection
public function errorInfo() public function errorInfo()
{ {
$this->connect(); $this->connect();
return $this->_conn->errorInfo(); return $this->_conn->errorInfo();
} }
...@@ -678,6 +692,7 @@ class Connection ...@@ -678,6 +692,7 @@ class Connection
public function lastInsertId($seqName = null) public function lastInsertId($seqName = null)
{ {
$this->connect(); $this->connect();
return $this->_conn->lastInsertId($seqName); return $this->_conn->lastInsertId($seqName);
} }
...@@ -692,10 +707,13 @@ class Connection ...@@ -692,10 +707,13 @@ class Connection
public function beginTransaction() public function beginTransaction()
{ {
$this->connect(); $this->connect();
if ($this->_transactionNestingLevel == 0) { if ($this->_transactionNestingLevel == 0) {
$this->_conn->beginTransaction(); $this->_conn->beginTransaction();
} }
++$this->_transactionNestingLevel; ++$this->_transactionNestingLevel;
return true; return true;
} }
...@@ -717,6 +735,7 @@ class Connection ...@@ -717,6 +735,7 @@ class Connection
if ($this->_transactionNestingLevel == 1) { if ($this->_transactionNestingLevel == 1) {
$this->_conn->commit(); $this->_conn->commit();
} }
--$this->_transactionNestingLevel; --$this->_transactionNestingLevel;
return true; return true;
...@@ -761,6 +780,7 @@ class Connection ...@@ -761,6 +780,7 @@ class Connection
public function getWrappedConnection() public function getWrappedConnection()
{ {
$this->connect(); $this->connect();
return $this->_conn; return $this->_conn;
} }
...@@ -775,6 +795,7 @@ class Connection ...@@ -775,6 +795,7 @@ class Connection
if ( ! $this->_schemaManager) { if ( ! $this->_schemaManager) {
$this->_schemaManager = $this->_driver->getSchemaManager($this); $this->_schemaManager = $this->_driver->getSchemaManager($this);
} }
return $this->_schemaManager; return $this->_schemaManager;
} }
} }
...@@ -964,7 +964,7 @@ abstract class AbstractSchemaManager ...@@ -964,7 +964,7 @@ abstract class AbstractSchemaManager
protected function _execSql($sql) protected function _execSql($sql)
{ {
foreach ((array) $sql as $query) { foreach ((array) $sql as $query) {
$this->_conn->exec($query); $this->_conn->executeUpdate($query);
} }
} }
} }
\ No newline at end of file
...@@ -114,6 +114,7 @@ abstract class Type ...@@ -114,6 +114,7 @@ abstract class Type
* Factory method to create type instances. * Factory method to create type instances.
* Type instances are implemented as flyweights. * Type instances are implemented as flyweights.
* *
* @static
* @param string $name The name of the type (as returned by getName()). * @param string $name The name of the type (as returned by getName()).
* @return Doctrine\DBAL\Types\Type * @return Doctrine\DBAL\Types\Type
*/ */
...@@ -123,37 +124,57 @@ abstract class Type ...@@ -123,37 +124,57 @@ abstract class Type
if ( ! isset(self::$_typesMap[$name])) { if ( ! isset(self::$_typesMap[$name])) {
throw DoctrineException::updateMe("Unknown type: $name"); throw DoctrineException::updateMe("Unknown type: $name");
} }
self::$_typeObjects[$name] = new self::$_typesMap[$name](); self::$_typeObjects[$name] = new self::$_typesMap[$name]();
} }
return self::$_typeObjects[$name]; return self::$_typeObjects[$name];
} }
/** /**
* Adds a custom type to the type map. * Adds a custom type to the type map.
* *
* @static
* @param string $name Name of the type. This should correspond to what * @param string $name Name of the type. This should correspond to what
* getName() returns. * getName() returns.
* @param string $className The class name of the custom type. * @param string $className The class name of the custom type.
* @throws DoctrineException
*/ */
public static function addCustomType($name, $className) public static function addType($name, $className)
{ {
if (isset(self::$_typesMap[$name])) { if (isset(self::$_typesMap[$name])) {
throw DoctrineException::typeExists($name); throw DoctrineException::typeExists($name);
} }
self::$_typesMap[$name] = $className; self::$_typesMap[$name] = $className;
} }
/**
* Checks if exists support for a type.
*
* @static
* @param string $name Name of the type
* @return boolean TRUE if type is supported; FALSE otherwise
*/
public static function hasType($name)
{
return isset(self::$_typesMap[$name]);
}
/** /**
* Overrides an already defined type to use a different implementation. * Overrides an already defined type to use a different implementation.
* *
* @static
* @param string $name * @param string $name
* @param string $className * @param string $className
* @throws DoctrineException
*/ */
public static function overrideType($name, $className) public static function overrideType($name, $className)
{ {
if ( ! isset(self::$_typesMap[$name])) { if ( ! isset(self::$_typesMap[$name])) {
throw DoctrineException::typeNotFound($name); throw DoctrineException::typeNotFound($name);
} }
self::$_typesMap[$name] = $className; self::$_typesMap[$name] = $className;
} }
} }
\ No newline at end of file
...@@ -67,7 +67,7 @@ abstract class AbstractCollectionPersister ...@@ -67,7 +67,7 @@ abstract class AbstractCollectionPersister
return; // ignore inverse side return; // ignore inverse side
} }
$sql = $this->_getDeleteSql($coll); $sql = $this->_getDeleteSql($coll);
$this->_conn->exec($sql, $this->_getDeleteSqlParameters($coll)); $this->_conn->executeUpdate($sql, $this->_getDeleteSqlParameters($coll));
} }
/** /**
...@@ -106,7 +106,7 @@ abstract class AbstractCollectionPersister ...@@ -106,7 +106,7 @@ abstract class AbstractCollectionPersister
$deleteDiff = $coll->getDeleteDiff(); $deleteDiff = $coll->getDeleteDiff();
$sql = $this->_getDeleteRowSql($coll); $sql = $this->_getDeleteRowSql($coll);
foreach ($deleteDiff as $element) { foreach ($deleteDiff as $element) {
$this->_conn->exec($sql, $this->_getDeleteRowSqlParameters($coll, $element)); $this->_conn->executeUpdate($sql, $this->_getDeleteRowSqlParameters($coll, $element));
} }
} }
...@@ -118,7 +118,7 @@ abstract class AbstractCollectionPersister ...@@ -118,7 +118,7 @@ abstract class AbstractCollectionPersister
$insertDiff = $coll->getInsertDiff(); $insertDiff = $coll->getInsertDiff();
$sql = $this->_getInsertRowSql($coll); $sql = $this->_getInsertRowSql($coll);
foreach ($insertDiff as $element) { foreach ($insertDiff as $element) {
$this->_conn->exec($sql, $this->_getInsertRowSqlParameters($coll, $element)); $this->_conn->executeUpdate($sql, $this->_getInsertRowSqlParameters($coll, $element));
} }
} }
......
...@@ -238,7 +238,7 @@ class StandardEntityPersister ...@@ -238,7 +238,7 @@ class StandardEntityPersister
. ' WHERE ' . implode(' = ? AND ', array_keys($where)) . ' WHERE ' . implode(' = ? AND ', array_keys($where))
. ' = ?'; . ' = ?';
$result = $this->_conn->exec($sql, $params); $result = $this->_conn->executeUpdate($sql, $params);
if ($isVersioned && ! $result) { if ($isVersioned && ! $result) {
throw \Doctrine\ORM\OptimisticLockException::optimisticLockFailed(); throw \Doctrine\ORM\OptimisticLockException::optimisticLockFailed();
......
...@@ -112,18 +112,18 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor ...@@ -112,18 +112,18 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
$numDeleted = 0; $numDeleted = 0;
// Create temporary id table // Create temporary id table
$conn->exec($this->_createTempTableSql); $conn->executeUpdate($this->_createTempTableSql);
// Insert identifiers // Insert identifiers
$numDeleted = $conn->exec($this->_insertSql, $params); $numDeleted = $conn->executeUpdate($this->_insertSql, $params);
// Execute DELETE statements // Execute DELETE statements
foreach ($this->_sqlStatements as $sql) { foreach ($this->_sqlStatements as $sql) {
$conn->exec($sql); $conn->executeUpdate($sql);
} }
// Drop temporary table // Drop temporary table
$conn->exec($this->_dropTempTableSql); $conn->executeUpdate($this->_dropTempTableSql);
return $numDeleted; return $numDeleted;
} }
......
...@@ -144,18 +144,18 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor ...@@ -144,18 +144,18 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
$numUpdated = 0; $numUpdated = 0;
// Create temporary id table // Create temporary id table
$conn->exec($this->_createTempTableSql); $conn->executeUpdate($this->_createTempTableSql);
// Insert identifiers. Parameters from the update clause are cut off. // Insert identifiers. Parameters from the update clause are cut off.
$numUpdated = $conn->exec($this->_insertSql, array_slice($params, $this->_numParametersInUpdateClause)); $numUpdated = $conn->executeUpdate($this->_insertSql, array_slice($params, $this->_numParametersInUpdateClause));
// Execute UPDATE statements // Execute UPDATE statements
for ($i=0, $count=count($this->_sqlStatements); $i<$count; ++$i) { for ($i=0, $count=count($this->_sqlStatements); $i<$count; ++$i) {
$conn->exec($this->_sqlStatements[$i], $this->_sqlParameters[$i]); $conn->executeUpdate($this->_sqlStatements[$i], $this->_sqlParameters[$i]);
} }
// Drop temporary table // Drop temporary table
$conn->exec($this->_dropTempTableSql); $conn->executeUpdate($this->_dropTempTableSql);
return $numUpdated; return $numUpdated;
} }
......
...@@ -47,6 +47,6 @@ class SingleTableDeleteUpdateExecutor extends AbstractSqlExecutor ...@@ -47,6 +47,6 @@ class SingleTableDeleteUpdateExecutor extends AbstractSqlExecutor
public function execute(\Doctrine\DBAL\Connection $conn, array $params) public function execute(\Doctrine\DBAL\Connection $conn, array $params)
{ {
return $conn->exec($this->_sqlStatements, $params); return $conn->executeUpdate($this->_sqlStatements, $params);
} }
} }
\ No newline at end of file
...@@ -69,32 +69,32 @@ class OrmFunctionalTestCase extends OrmTestCase ...@@ -69,32 +69,32 @@ class OrmFunctionalTestCase extends OrmTestCase
{ {
$conn = $this->sharedFixture['conn']; $conn = $this->sharedFixture['conn'];
if (isset($this->_usedModelSets['cms'])) { if (isset($this->_usedModelSets['cms'])) {
$conn->exec('DELETE FROM cms_users_groups'); $conn->executeUpdate('DELETE FROM cms_users_groups');
$conn->exec('DELETE FROM cms_groups'); $conn->executeUpdate('DELETE FROM cms_groups');
$conn->exec('DELETE FROM cms_addresses'); $conn->executeUpdate('DELETE FROM cms_addresses');
$conn->exec('DELETE FROM cms_phonenumbers'); $conn->executeUpdate('DELETE FROM cms_phonenumbers');
$conn->exec('DELETE FROM cms_articles'); $conn->executeUpdate('DELETE FROM cms_articles');
$conn->exec('DELETE FROM cms_users'); $conn->executeUpdate('DELETE FROM cms_users');
} }
if (isset($this->_usedModelSets['ecommerce'])) { if (isset($this->_usedModelSets['ecommerce'])) {
$conn->exec('DELETE FROM ecommerce_carts_products'); $conn->executeUpdate('DELETE FROM ecommerce_carts_products');
$conn->exec('DELETE FROM ecommerce_products_categories'); $conn->executeUpdate('DELETE FROM ecommerce_products_categories');
$conn->exec('DELETE FROM ecommerce_products_related'); $conn->executeUpdate('DELETE FROM ecommerce_products_related');
$conn->exec('DELETE FROM ecommerce_carts'); $conn->executeUpdate('DELETE FROM ecommerce_carts');
$conn->exec('DELETE FROM ecommerce_customers'); $conn->executeUpdate('DELETE FROM ecommerce_customers');
$conn->exec('DELETE FROM ecommerce_features'); $conn->executeUpdate('DELETE FROM ecommerce_features');
$conn->exec('DELETE FROM ecommerce_products'); $conn->executeUpdate('DELETE FROM ecommerce_products');
$conn->exec('DELETE FROM ecommerce_shippings'); $conn->executeUpdate('DELETE FROM ecommerce_shippings');
$conn->exec('DELETE FROM ecommerce_categories'); $conn->executeUpdate('DELETE FROM ecommerce_categories');
} }
if (isset($this->_usedModelSets['company'])) { if (isset($this->_usedModelSets['company'])) {
$conn->exec('DELETE FROM company_persons_friends'); $conn->executeUpdate('DELETE FROM company_persons_friends');
$conn->exec('DELETE FROM company_managers'); $conn->executeUpdate('DELETE FROM company_managers');
$conn->exec('DELETE FROM company_employees'); $conn->executeUpdate('DELETE FROM company_employees');
$conn->exec('DELETE FROM company_persons'); $conn->executeUpdate('DELETE FROM company_persons');
} }
if (isset($this->_usedModelSets['generic'])) { if (isset($this->_usedModelSets['generic'])) {
$conn->exec('DELETE FROM date_time_model'); $conn->executeUpdate('DELETE FROM date_time_model');
} }
$this->_em->clear(); $this->_em->clear();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment