1
0
mirror of synced 2025-01-29 19:41:45 +03:00

replace tabs with 4 spaces. and fix other coding style related stuff

This commit is contained in:
meus 2007-09-03 14:57:18 +00:00
parent d3e4b2c912
commit f3a377a794
126 changed files with 1005 additions and 1005 deletions

View File

@ -108,7 +108,7 @@ final class Doctrine
const FETCH_UNIQUE = 196608; const FETCH_UNIQUE = 196608;
const NULL_EMPTY_STRING = 1; const NULL_EMPTY_STRING = 1;
const NULL_NATURAL = 0; const NULL_NATURAL = 0;
const NULL_TO_STRING = NULL; const NULL_TO_STRING = NULL;
const PARAM_BOOL = 5; const PARAM_BOOL = 5;
const PARAM_INPUT_OUTPUT = -2147483648; const PARAM_INPUT_OUTPUT = -2147483648;
const PARAM_INT = 1; const PARAM_INT = 1;
@ -480,7 +480,7 @@ final class Doctrine
if (class_exists($classname, false)) { if (class_exists($classname, false)) {
return false; return false;
} }
if (! self::$path) { if ( ! self::$path) {
self::$path = dirname(__FILE__); self::$path = dirname(__FILE__);
} }
$class = self::$path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR,$classname) . '.php'; $class = self::$path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR,$classname) . '.php';
@ -504,7 +504,7 @@ final class Doctrine
*/ */
public static function dump($var, $output = true) public static function dump($var, $output = true)
{ {
$ret = array(); $ret = array();
switch (gettype($var)) { switch (gettype($var)) {
case 'array': case 'array':
$ret[] = 'Array('; $ret[] = 'Array(';

View File

@ -145,12 +145,12 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter
$conn_func_name = 'db2_connect'; $conn_func_name = 'db2_connect';
} }
if (!isset($this->_config['options'])) { if ( ! isset($this->_config['options'])) {
// config options were not set, so set it to an empty array // config options were not set, so set it to an empty array
$this->_config['options'] = array(); $this->_config['options'] = array();
} }
if (!isset($this->_config['options']['autocommit'])) { if ( ! isset($this->_config['options']['autocommit'])) {
// set execution mode // set execution mode
$this->_config['options']['autocommit'] = &$this->_execute_mode; $this->_config['options']['autocommit'] = &$this->_execute_mode;
} }
@ -181,7 +181,7 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter
} }
// check the connection // check the connection
if (!$this->_connection) { if ( ! $this->_connection) {
throw new Doctrine_Adapter_Db2_Exception(db2_conn_errormsg(), db2_conn_error()); throw new Doctrine_Adapter_Db2_Exception(db2_conn_errormsg(), db2_conn_error());
} }
} }
@ -286,7 +286,7 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter
*/ */
protected function _commit() protected function _commit()
{ {
if (!db2_commit($this->_connection)) { if ( ! db2_commit($this->_connection)) {
throw new Doctrine_Adapter_Db2_Exception( throw new Doctrine_Adapter_Db2_Exception(
db2_conn_errormsg($this->_connection), db2_conn_errormsg($this->_connection),
db2_conn_error($this->_connection)); db2_conn_error($this->_connection));
@ -302,7 +302,7 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter
*/ */
protected function _rollBack() protected function _rollBack()
{ {
if (!db2_rollback($this->_connection)) { if ( ! db2_rollback($this->_connection)) {
throw new Doctrine_Adapter_Db2_Exception( throw new Doctrine_Adapter_Db2_Exception(
db2_conn_errormsg($this->_connection), db2_conn_errormsg($this->_connection),
db2_conn_error($this->_connection)); db2_conn_error($this->_connection));

View File

@ -74,7 +74,7 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable
$e = $this->exception; $e = $this->exception;
if( ! empty($e)) { if ( ! empty($e)) {
$name = $e[0]; $name = $e[0];
$this->exception = array(); $this->exception = array();
@ -101,7 +101,7 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable
$e = $this->exception; $e = $this->exception;
if( ! empty($e)) { if ( ! empty($e)) {
$name = $e[0]; $name = $e[0];
$this->exception = array(); $this->exception = array();
@ -121,16 +121,16 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable
} }
public function lastInsertId() public function lastInsertId()
{ {
$this->queries[] = 'LAST_INSERT_ID()'; $this->queries[] = 'LAST_INSERT_ID()';
if ($this->lastInsertIdFail) { if ($this->lastInsertIdFail) {
return null; return null;
} else { } else {
return 1; return 1;
} }
} }
public function count() public function count()
{ {
return count($this->queries); return count($this->queries);
} }
public function beginTransaction() public function beginTransaction()
{ {
@ -150,12 +150,12 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable
{ } { }
public function getAttribute($attribute) public function getAttribute($attribute)
{ {
if($attribute == Doctrine::ATTR_DRIVER_NAME) if ($attribute == Doctrine::ATTR_DRIVER_NAME)
return strtolower($this->name); return strtolower($this->name);
} }
public function setAttribute($attribute, $value) public function setAttribute($attribute, $value)
{ {
} }
public function sqliteCreateFunction() public function sqliteCreateFunction()
{ } { }

View File

@ -110,7 +110,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
return; return;
} }
if (!extension_loaded('oci8')) { if ( ! extension_loaded('oci8')) {
throw new Doctrine_Adapter_Oracle_Exception('The OCI8 extension is required for this adapter but not loaded'); throw new Doctrine_Adapter_Oracle_Exception('The OCI8 extension is required for this adapter but not loaded');
} }
@ -126,7 +126,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
} }
// check the connection // check the connection
if (!$this->_connection) { if ( ! $this->_connection) {
throw new Doctrine_Adapter_Oracle_Exception(oci_error()); throw new Doctrine_Adapter_Oracle_Exception(oci_error());
} }
} }
@ -199,7 +199,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
*/ */
protected function _commit() protected function _commit()
{ {
if (!oci_commit($this->_connection)) { if ( ! oci_commit($this->_connection)) {
throw new Doctrine_Adapter_Oracle_Exception(oci_error($this->_connection)); throw new Doctrine_Adapter_Oracle_Exception(oci_error($this->_connection));
} }
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS); $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
@ -212,7 +212,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
*/ */
protected function _rollBack() protected function _rollBack()
{ {
if (!oci_rollback($this->_connection)) { if ( ! oci_rollback($this->_connection)) {
throw new Doctrine_Adapter_Oracle_Exception(oci_error($this->_connection)); throw new Doctrine_Adapter_Oracle_Exception(oci_error($this->_connection));
} }
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS); $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);

View File

@ -54,7 +54,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
*/ */
public function bindColumn($column, $param, $type = null) public function bindColumn($column, $param, $type = null)
{ {
} }
/** /**
* bindValue * bindValue
@ -72,7 +72,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
*/ */
public function bindValue($param, $value, $type = null) public function bindValue($param, $value, $type = null)
{ {
} }
/** /**
* bindParam * bindParam
@ -103,7 +103,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
*/ */
public function bindParam($column, $variable, $type = null, $length = null, $driverOptions = array()) public function bindParam($column, $variable, $type = null, $length = null, $driverOptions = array())
{ {
} }
/** /**
* closeCursor * closeCursor
@ -125,7 +125,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
*/ */
public function columnCount() public function columnCount()
{ {
return 0; return 0;
} }
/** /**
* errorCode * errorCode
@ -216,7 +216,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
*/ */
public function execute($params = null) public function execute($params = null)
{ {
if(is_object($this->mock)) { if (is_object($this->mock)) {
$this->mock->addQuery($this->queryString); $this->mock->addQuery($this->queryString);
} }
return true; return true;

View File

@ -40,7 +40,7 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener
} }
public function preInsert(Doctrine_Event $event) public function preInsert(Doctrine_Event $event)
{ {
$versionColumn = $this->_auditLog->getOption('versionColumn'); $versionColumn = $this->_auditLog->getOption('versionColumn');
$event->getInvoker()->set($versionColumn, 1); $event->getInvoker()->set($versionColumn, 1);
} }
@ -54,23 +54,23 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener
$version->merge($record->toArray()); $version->merge($record->toArray());
$version->save(); $version->save();
$versionColumn = $this->_auditLog->getOption('versionColumn'); $versionColumn = $this->_auditLog->getOption('versionColumn');
$version = $record->get($versionColumn); $version = $record->get($versionColumn);
$record->set($versionColumn, ++$version); $record->set($versionColumn, ++$version);
} }
public function preUpdate(Doctrine_Event $event) public function preUpdate(Doctrine_Event $event)
{ {
$class = $this->_auditLog->getOption('className'); $class = $this->_auditLog->getOption('className');
$record = $event->getInvoker(); $record = $event->getInvoker();
$version = new $class(); $version = new $class();
$version->merge($record->toArray()); $version->merge($record->toArray());
$version->save(); $version->save();
$versionColumn = $this->_auditLog->getOption('versionColumn'); $versionColumn = $this->_auditLog->getOption('versionColumn');
$version = $record->get($versionColumn); $version = $record->get($versionColumn);
$record->set($versionColumn, ++$version); $record->set($versionColumn, ++$version);
} }

View File

@ -67,13 +67,13 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
*/ */
public function __construct($driver, $options = array()) public function __construct($driver, $options = array())
{ {
if (is_object($driver)) { if (is_object($driver)) {
if ( ! ($driver instanceof Doctrine_Cache_Interface)) { if ( ! ($driver instanceof Doctrine_Cache_Interface)) {
throw new Doctrine_Cache_Exception('Driver should implement Doctrine_Cache_Interface.'); throw new Doctrine_Cache_Exception('Driver should implement Doctrine_Cache_Interface.');
} }
$this->_driver = $driver; $this->_driver = $driver;
$this->_driver->setOptions($options); $this->_driver->setOptions($options);
} else { } else {
$class = 'Doctrine_Cache_' . ucwords(strtolower($driver)); $class = 'Doctrine_Cache_' . ucwords(strtolower($driver));
@ -103,12 +103,12 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
*/ */
public function setOption($option, $value) public function setOption($option, $value)
{ {
// sanity check (we need this since we are using isset() instead of array_key_exists()) // sanity check (we need this since we are using isset() instead of array_key_exists())
if ($value === null) { if ($value === null) {
throw new Doctrine_Cache_Exception('Null values not accepted for options.'); throw new Doctrine_Cache_Exception('Null values not accepted for options.');
} }
if (isset($this->_options[$option])) { if (isset($this->_options[$option])) {
$this->_options[$option] = $value; $this->_options[$option] = $value;
return true; return true;
} }
@ -138,7 +138,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
*/ */
public function add($query, $namespace = null) public function add($query, $namespace = null)
{ {
if (isset($namespace)) { if (isset($namespace)) {
$this->_queries[$namespace][] = $query; $this->_queries[$namespace][] = $query;
} else { } else {
$this->_queries[] = $query; $this->_queries[] = $query;
@ -153,7 +153,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
public function getAll($namespace = null) public function getAll($namespace = null)
{ {
if (isset($namespace)) { if (isset($namespace)) {
if( ! isset($this->_queries[$namespace])) { if ( ! isset($this->_queries[$namespace])) {
return array(); return array();
} }
@ -216,7 +216,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
{ {
$rand = (mt_rand() / mt_getrandmax()); $rand = (mt_rand() / mt_getrandmax());
if ($rand <= $this->_options['cleanPropability']) { if ($rand <= $this->_options['cleanPropability']) {
$queries = $this->readStats(); $queries = $this->readStats();
$stats = array(); $stats = array();
@ -249,14 +249,14 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
*/ */
public function readStats() public function readStats()
{ {
if ($this->_options['statsFile'] !== false) { if ($this->_options['statsFile'] !== false) {
$content = file_get_contents($this->_options['statsFile']); $content = file_get_contents($this->_options['statsFile']);
$e = explode("\n", $content); $e = explode("\n", $content);
return array_map('unserialize', $e); return array_map('unserialize', $e);
} }
return array(); return array();
} }
/** /**
* appendStats * appendStats
@ -266,7 +266,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
*/ */
public function appendStats() public function appendStats()
{ {
if ($this->_options['statsFile'] !== false) { if ($this->_options['statsFile'] !== false) {
if ( ! file_exists($this->_options['statsFile'])) { if ( ! file_exists($this->_options['statsFile'])) {
throw new Doctrine_Cache_Exception("Couldn't save cache statistics. Cache statistics file doesn't exists!"); throw new Doctrine_Cache_Exception("Couldn't save cache statistics. Cache statistics file doesn't exists!");
@ -335,7 +335,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
public function preFetch(Doctrine_Event $event) public function preFetch(Doctrine_Event $event)
{ {
$ret = current($this->_data); $ret = current($this->_data);
next($this->_data); next($this->_data);
return $ret; return $ret;
} }
/** /**

View File

@ -40,18 +40,18 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
*/ */
public function __construct($options) public function __construct($options)
{ {
if ( ! isset($options['connection']) || if ( ! isset($options['connection']) ||
! ($options['connection'] instanceof Doctrine_Connection)) { ! ($options['connection'] instanceof Doctrine_Connection)) {
throw new Doctrine_Cache_Exception('Connection option not set.'); throw new Doctrine_Cache_Exception('Connection option not set.');
} }
if ( ! isset($options['tableName']) || if ( ! isset($options['tableName']) ||
! is_string($options['tableName'])) { ! is_string($options['tableName'])) {
throw new Doctrine_Cache_Exception('Table name option not set.'); throw new Doctrine_Cache_Exception('Table name option not set.');
} }
$this->_options = $options; $this->_options = $options;
} }

View File

@ -56,7 +56,7 @@ abstract class Doctrine_Cache_Driver implements Doctrine_Cache_Interface
*/ */
public function setOption($option, $value) public function setOption($option, $value)
{ {
if (isset($this->_options[$option])) { if (isset($this->_options[$option])) {
$this->_options[$option] = $value; $this->_options[$option] = $value;
return true; return true;
} }

View File

@ -113,7 +113,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*/ */
public function setData(array $data) public function setData(array $data)
{ {
$this->data = $data; $this->data = $data;
} }
/** /**
* this method is automatically called when this Doctrine_Collection is serialized * this method is automatically called when this Doctrine_Collection is serialized
@ -300,8 +300,8 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*/ */
public function get($key) public function get($key)
{ {
if ($key === null || ! isset($this->data[$key])) { if ($key === null || ! isset($this->data[$key])) {
$record = $this->_table->create(); $record = $this->_table->create();
if (isset($this->referenceField)) { if (isset($this->referenceField)) {
$value = $this->reference->get($this->relation->getLocal()); $value = $this->reference->get($this->relation->getLocal());
@ -316,7 +316,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$this->data[] = $record; $this->data[] = $record;
return $record; return $record;
} }
return $this->data[$key]; return $this->data[$key];
} }

View File

@ -163,7 +163,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/ */
public function __construct(Doctrine_Manager $manager, $adapter, $user = null, $pass = null) public function __construct(Doctrine_Manager $manager, $adapter, $user = null, $pass = null)
{ {
if (is_object($adapter)) { if (is_object($adapter)) {
if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) { if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) {
throw new Doctrine_Connection_Exception('First argument should be an instance of PDO or implement Doctrine_Adapter_Interface'); throw new Doctrine_Connection_Exception('First argument should be an instance of PDO or implement Doctrine_Adapter_Interface');
} }
@ -171,7 +171,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
$this->isConnected = true; $this->isConnected = true;
} elseif(is_array($adapter)) { } elseif (is_array($adapter)) {
$this->pendingAttributes[Doctrine::ATTR_DRIVER_NAME] = $adapter['scheme']; $this->pendingAttributes[Doctrine::ATTR_DRIVER_NAME] = $adapter['scheme'];
$this->options['dsn'] = $adapter['dsn']; $this->options['dsn'] = $adapter['dsn'];
@ -196,12 +196,12 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
public function getAttribute($attribute) public function getAttribute($attribute)
{ {
if ($attribute >= 100) { if ($attribute >= 100) {
if ( ! isset($this->attributes[$attribute])) { if ( ! isset($this->attributes[$attribute])) {
return $this->parent->getAttribute($attribute); return $this->parent->getAttribute($attribute);
} }
return $this->attributes[$attribute]; return $this->attributes[$attribute];
} }
if ($this->isConnected) { if ($this->isConnected) {
try { try {
@ -235,9 +235,9 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/ */
public function setAttribute($attribute, $value) public function setAttribute($attribute, $value)
{ {
if ($attribute >= 100) { if ($attribute >= 100) {
parent::setAttribute($attribute, $value); parent::setAttribute($attribute, $value);
} else { } else {
if ($this->isConnected) { if ($this->isConnected) {
$this->dbh->setAttribute($attribute, $value); $this->dbh->setAttribute($attribute, $value);
} else { } else {
@ -310,8 +310,8 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/ */
public function getDbh() public function getDbh()
{ {
$this->connect(); $this->connect();
return $this->dbh; return $this->dbh;
} }
/** /**
@ -348,14 +348,14 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
if (class_exists($class)) { if (class_exists($class)) {
$this->dbh = new $class($this->options['dsn'], $this->options['username'], $this->options['password']); $this->dbh = new $class($this->options['dsn'], $this->options['username'], $this->options['password']);
} else { } else {
throw new Doctrine_Connection_Exception("Couldn't locate driver named " . $e[0]); throw new Doctrine_Connection_Exception("Couldn't locate driver named " . $e[0]);
} }
} }
// attach the pending attributes to adapter // attach the pending attributes to adapter
foreach($this->pendingAttributes as $attr => $value) { foreach($this->pendingAttributes as $attr => $value) {
// some drivers don't support setting this so we just skip it // some drivers don't support setting this so we just skip it
if($attr == Doctrine::ATTR_DRIVER_NAME) { if ($attr == Doctrine::ATTR_DRIVER_NAME) {
continue; continue;
} }
$this->dbh->setAttribute($attr, $value); $this->dbh->setAttribute($attr, $value);
@ -540,7 +540,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/ */
public function quoteIdentifier($str, $checkOption = true) public function quoteIdentifier($str, $checkOption = true)
{ {
// quick fix for the identifiers that contain a dot // quick fix for the identifiers that contain a dot
if (strpos($str, '.')) { if (strpos($str, '.')) {
$e = explode('.', $str); $e = explode('.', $str);
@ -781,7 +781,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/ */
public function execute($query, array $params = array()) public function execute($query, array $params = array())
{ {
$this->connect(); $this->connect();
try { try {
if ( ! empty($params)) { if ( ! empty($params)) {
@ -815,7 +815,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
* @return PDOStatement|Doctrine_Adapter_Statement * @return PDOStatement|Doctrine_Adapter_Statement
*/ */
public function exec($query, array $params = array()) { public function exec($query, array $params = array()) {
$this->connect(); $this->connect();
try { try {
if ( ! empty($params)) { if ( ! empty($params)) {
@ -849,9 +849,9 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/ */
public function rethrowException(Exception $e, $invoker) public function rethrowException(Exception $e, $invoker)
{ {
$event = new Doctrine_Event($this, Doctrine_Event::CONN_ERROR); $event = new Doctrine_Event($this, Doctrine_Event::CONN_ERROR);
$this->getListener()->preError($event); $this->getListener()->preError($event);
$name = 'Doctrine_Connection_' . $this->driverName . '_Exception'; $name = 'Doctrine_Connection_' . $this->driverName . '_Exception';
@ -1011,7 +1011,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/ */
public function close() public function close()
{ {
$event = new Doctrine_Event($this, Doctrine_Event::CONN_CLOSE); $event = new Doctrine_Event($this, Doctrine_Event::CONN_CLOSE);
$this->getAttribute(Doctrine::ATTR_LISTENER)->preClose($event); $this->getAttribute(Doctrine::ATTR_LISTENER)->preClose($event);
@ -1039,7 +1039,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/ */
public function errorCode() public function errorCode()
{ {
$this->connect(); $this->connect();
return $this->dbh->errorCode(); return $this->dbh->errorCode();
} }
@ -1051,7 +1051,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/ */
public function errorInfo() public function errorInfo()
{ {
$this->connect(); $this->connect();
return $this->dbh->errorInfo(); return $this->dbh->errorInfo();
} }

View File

@ -41,9 +41,9 @@ class Doctrine_Connection_Common extends Doctrine_Connection
*/ */
public function modifyLimitQuery($query, $limit = false,$offset = false,$isManip=false) public function modifyLimitQuery($query, $limit = false,$offset = false,$isManip=false)
{ {
$limit = (int) $limit; $limit = (int) $limit;
$offset = (int) $offset; $offset = (int) $offset;
if ($limit && $offset) { if ($limit && $offset) {
$query .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; $query .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
} elseif ($limit && ! $offset) { } elseif ($limit && ! $offset) {

View File

@ -101,17 +101,17 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
*/ */
public function convertBooleans($item) public function convertBooleans($item)
{ {
if (is_array($item)) { if (is_array($item)) {
foreach ($item as $key => $value) { foreach ($item as $key => $value) {
if (is_bool($value)) { if (is_bool($value)) {
$item[$key] = ($value) ? 'true' : 'false'; $item[$key] = ($value) ? 'true' : 'false';
} }
} }
} else { } else {
if (is_bool($item)) { if (is_bool($item)) {
$item = ($item) ? 'true' : 'false'; $item = ($item) ? 'true' : 'false';
} }
} }
return $item; return $item;
} }
/** /**

View File

@ -61,8 +61,8 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
* @return boolean * @return boolean
*/ */
public function setFilterQueryType() { public function setFilterQueryType() {
} }
/** /**
* method overloader * method overloader
* this method is used for invoking different listeners, for the full * this method is used for invoking different listeners, for the full
@ -85,7 +85,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
// pre-event listener found // pre-event listener found
$a[0]->start(); $a[0]->start();
if( ! in_array($a[0], $this->events, true)) { if ( ! in_array($a[0], $this->events, true)) {
$this->events[] = $a[0]; $this->events[] = $a[0];
} }
} else { } else {
@ -126,7 +126,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
*/ */
public function getAll() public function getAll()
{ {
return $this->events; return $this->events;
} }
/** /**
* getIterator * getIterator

View File

@ -89,7 +89,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
*/ */
public function bindColumn($column, $param, $type = null) public function bindColumn($column, $param, $type = null)
{ {
if($type === null) { if ($type === null) {
return $this->_stmt->bindColumn($column, $param); return $this->_stmt->bindColumn($column, $param);
} else { } else {
return $this->_stmt->bindColumn($column, $param, $type); return $this->_stmt->bindColumn($column, $param, $type);
@ -111,7 +111,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
*/ */
public function bindValue($param, $value, $type = null) public function bindValue($param, $value, $type = null)
{ {
if($type === null) { if ($type === null) {
return $this->_stmt->bindValue($param, $value); return $this->_stmt->bindValue($param, $value);
} else { } else {
return $this->_stmt->bindValue($param, $value, $type); return $this->_stmt->bindValue($param, $value, $type);
@ -146,7 +146,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
*/ */
public function bindParam($column, $variable, $type = null, $length = null, $driverOptions = array()) public function bindParam($column, $variable, $type = null, $length = null, $driverOptions = array())
{ {
if($type === null) { if ($type === null) {
return $this->_stmt->bindParam($column, $variable); return $this->_stmt->bindParam($column, $variable);
} else { } else {
return $this->_stmt->bindParam($column, $variable, $type, $length, $driverOptions); return $this->_stmt->bindParam($column, $variable, $type, $length, $driverOptions);

View File

@ -139,7 +139,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
*/ */
public function saveGraph(Doctrine_Record $record) public function saveGraph(Doctrine_Record $record)
{ {
$conn = $this->getConnection(); $conn = $this->getConnection();
$state = $record->state(); $state = $record->state();
if ($state === Doctrine_Record::STATE_LOCKED) { if ($state === Doctrine_Record::STATE_LOCKED) {
@ -319,7 +319,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record = false; $record = false;
$ids = array(); $ids = array();
if (is_array($deletes[count($deletes)-1]->getTable()->getIdentifier())) { if (is_array($deletes[count($deletes)-1]->getTable()->getIdentifier())) {
if (count($deletes) > 0) { if (count($deletes) > 0) {
$query = 'DELETE FROM ' $query = 'DELETE FROM '
. $this->conn->quoteIdentifier($deletes[0]->getTable()->getTableName()) . $this->conn->quoteIdentifier($deletes[0]->getTable()->getTableName())
@ -330,7 +330,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
foreach ($deletes as $k => $record) { foreach ($deletes as $k => $record) {
$ids = $record->identifier(); $ids = $record->identifier();
$tmp = array(); $tmp = array();
foreach (array_keys($ids) as $id){ foreach (array_keys($ids) as $id) {
$tmp[] = $id . ' = ? '; $tmp[] = $id . ' = ? ';
} }
$params = array_merge($params, array_values($ids)); $params = array_merge($params, array_values($ids));
@ -340,22 +340,22 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$this->conn->execute($query, $params); $this->conn->execute($query, $params);
} }
} else { } else {
foreach ($deletes as $k => $record) { foreach ($deletes as $k => $record) {
$ids[] = $record->getIncremented(); $ids[] = $record->getIncremented();
} }
if ($record instanceof Doctrine_Record) { if ($record instanceof Doctrine_Record) {
$params = substr(str_repeat('?, ', count($ids)), 0, -2); $params = substr(str_repeat('?, ', count($ids)), 0, -2);
$query = 'DELETE FROM ' $query = 'DELETE FROM '
. $this->conn->quoteIdentifier($record->getTable()->getTableName()) . $this->conn->quoteIdentifier($record->getTable()->getTableName())
. ' WHERE ' . ' WHERE '
. $record->getTable()->getIdentifier() . $record->getTable()->getIdentifier()
. ' IN(' . $params . ')'; . ' IN(' . $params . ')';
$this->conn->execute($query, $ids); $this->conn->execute($query, $ids);
} }
} }
} }
} }
/** /**
@ -450,7 +450,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$obj->state() != Doctrine_Record::STATE_LOCKED) { $obj->state() != Doctrine_Record::STATE_LOCKED) {
$obj->delete($this->conn); $obj->delete($this->conn);
} }
break; break;
} }

View File

@ -43,7 +43,7 @@ class Doctrine_DataDict extends Doctrine_Connection_Module
{ {
$type = !empty($current['type']) ? $current['type'] : null; $type = !empty($current['type']) ? $current['type'] : null;
if (!method_exists($this, "_compare{$type}Definition")) { if ( ! method_exists($this, "_compare{$type}Definition")) {
throw new Doctrine_DataDict_Exception('type "'.$current['type'].'" is not yet supported'); throw new Doctrine_DataDict_Exception('type "'.$current['type'].'" is not yet supported');
} }

View File

@ -57,9 +57,9 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
*/ */
public function getNativeDeclaration($field) public function getNativeDeclaration($field)
{ {
if ( ! isset($field['type'])) { if ( ! isset($field['type'])) {
throw new Doctrine_DataDict_Exception('Missing column type.'); throw new Doctrine_DataDict_Exception('Missing column type.');
} }
switch ($field['type']) { switch ($field['type']) {
case 'varchar': case 'varchar':
case 'string': case 'string':

View File

@ -56,9 +56,9 @@ class Doctrine_DataDict_Informix extends Doctrine_DataDict
*/ */
public function getNativeDeclaration($field) public function getNativeDeclaration($field)
{ {
if ( ! isset($field['type'])) { if ( ! isset($field['type'])) {
throw new Doctrine_DataDict_Exception('Missing column type.'); throw new Doctrine_DataDict_Exception('Missing column type.');
} }
switch ($field['type']) { switch ($field['type']) {
case 'char': case 'char':
case 'varchar': case 'varchar':
@ -69,7 +69,7 @@ class Doctrine_DataDict_Informix extends Doctrine_DataDict
$field['length'] = $this->conn->varchar_max_length; $field['length'] = $this->conn->varchar_max_length;
} }
$length = (! empty($field['length'])) ? $field['length'] : false; $length = ( ! empty($field['length'])) ? $field['length'] : false;
$fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; $fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false;
return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR(255)') return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR(255)')
@ -79,7 +79,7 @@ class Doctrine_DataDict_Informix extends Doctrine_DataDict
case 'blob': case 'blob':
return 'BLOB'; return 'BLOB';
case 'integer': case 'integer':
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 1) { if ($length <= 1) {
return 'SMALLINT'; return 'SMALLINT';

View File

@ -59,9 +59,9 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
*/ */
public function getNativeDeclaration($field) public function getNativeDeclaration($field)
{ {
if ( ! isset($field['type'])) { if ( ! isset($field['type'])) {
throw new Doctrine_DataDict_Exception('Missing column type.'); throw new Doctrine_DataDict_Exception('Missing column type.');
} }
switch ($field['type']) { switch ($field['type']) {
case 'array': case 'array':
case 'object': case 'object':
@ -78,7 +78,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->options['default_text_field_length'].')') return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->options['default_text_field_length'].')')
: ($length ? 'VARCHAR('.$length.')' : 'TEXT'); : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
case 'clob': case 'clob':
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 8000) { if ($length <= 8000) {
return 'VARCHAR('.$length.')'; return 'VARCHAR('.$length.')';
@ -86,7 +86,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
} }
return 'TEXT'; return 'TEXT';
case 'blob': case 'blob':
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 8000) { if ($length <= 8000) {
return "VARBINARY($length)"; return "VARBINARY($length)";

View File

@ -140,7 +140,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
switch ($field['type']) { switch ($field['type']) {
case 'char': case 'char':
$length = (! empty($field['length'])) ? $field['length'] : false; $length = ( ! empty($field['length'])) ? $field['length'] : false;
return $length ? 'CHAR('.$length.')' : 'CHAR(255)'; return $length ? 'CHAR('.$length.')' : 'CHAR(255)';
case 'varchar': case 'varchar':
@ -162,7 +162,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)') return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)')
: ($length ? 'VARCHAR(' . $length . ')' : 'TEXT'); : ($length ? 'VARCHAR(' . $length . ')' : 'TEXT');
case 'clob': case 'clob':
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 255) { if ($length <= 255) {
return 'TINYTEXT'; return 'TINYTEXT';
@ -174,7 +174,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
} }
return 'LONGTEXT'; return 'LONGTEXT';
case 'blob': case 'blob':
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 255) { if ($length <= 255) {
return 'TINYBLOB'; return 'TINYBLOB';
@ -196,7 +196,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
// fall back to integer // fall back to integer
case 'integer': case 'integer':
case 'int': case 'int':
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 1) { if ($length <= 1) {
return 'TINYINT'; return 'TINYINT';
@ -439,7 +439,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
public function getIntegerDeclaration($name, $field) public function getIntegerDeclaration($name, $field)
{ {
$default = $autoinc = ''; $default = $autoinc = '';
if (!empty($field['autoincrement'])) { if ( ! empty($field['autoincrement'])) {
$autoinc = ' AUTO_INCREMENT'; $autoinc = ' AUTO_INCREMENT';
} elseif (array_key_exists('default', $field)) { } elseif (array_key_exists('default', $field)) {
if ($field['default'] === '') { if ($field['default'] === '') {

View File

@ -55,9 +55,9 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
*/ */
public function getNativeDeclaration(array $field) public function getNativeDeclaration(array $field)
{ {
if ( ! isset($field['type'])) { if ( ! isset($field['type'])) {
throw new Doctrine_DataDict_Exception('Missing column type.'); throw new Doctrine_DataDict_Exception('Missing column type.');
} }
switch ($field['type']) { switch ($field['type']) {
case 'string': case 'string':
case 'array': case 'array':
@ -78,7 +78,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
case 'integer': case 'integer':
case 'enum': case 'enum':
case 'int': case 'int':
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
return 'NUMBER('.$field['length'].')'; return 'NUMBER('.$field['length'].')';
} }
return 'INT'; return 'INT';
@ -110,7 +110,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
$dbType = strtolower($field['type']); $dbType = strtolower($field['type']);
$type = array(); $type = array();
$length = $unsigned = $fixed = null; $length = $unsigned = $fixed = null;
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
} }
@ -156,7 +156,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
$type[] = 'float'; $type[] = 'float';
break; break;
case 'number': case 'number':
if (!empty($field['scale'])) { if ( ! empty($field['scale'])) {
$type[] = 'decimal'; $type[] = 'decimal';
} else { } else {
$type[] = 'integer'; $type[] = 'integer';

View File

@ -360,9 +360,9 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
*/ */
public function getNativeDeclaration(array $field) public function getNativeDeclaration(array $field)
{ {
if ( ! isset($field['type'])) { if ( ! isset($field['type'])) {
throw new Doctrine_DataDict_Exception('Missing column type.'); throw new Doctrine_DataDict_Exception('Missing column type.');
} }
switch ($field['type']) { switch ($field['type']) {
case 'char': case 'char':
case 'string': case 'string':
@ -385,8 +385,8 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
case 'enum': case 'enum':
case 'integer': case 'integer':
case 'int': case 'int':
if (!empty($field['autoincrement'])) { if ( ! empty($field['autoincrement'])) {
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length > 4) { if ($length > 4) {
return 'BIGSERIAL'; return 'BIGSERIAL';
@ -394,7 +394,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
} }
return 'SERIAL'; return 'SERIAL';
} }
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 2) { if ($length <= 2) {
return 'SMALLINT'; return 'SMALLINT';
@ -578,7 +578,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
public function getIntegerDeclaration($name, $field) public function getIntegerDeclaration($name, $field)
{ {
/** /**
if (!empty($field['unsigned'])) { if ( ! empty($field['unsigned'])) {
$this->conn->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer"; $this->conn->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer";
} }
*/ */

View File

@ -57,9 +57,9 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
*/ */
public function getNativeDeclaration(array $field) public function getNativeDeclaration(array $field)
{ {
if ( ! isset($field['type'])) { if ( ! isset($field['type'])) {
throw new Doctrine_DataDict_Exception('Missing column type.'); throw new Doctrine_DataDict_Exception('Missing column type.');
} }
switch ($field['type']) { switch ($field['type']) {
case 'text': case 'text':
case 'object': case 'object':
@ -75,7 +75,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->getAttribute(Doctrine::ATTR_DEFAULT_TEXTFLD_LENGTH).')') return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->getAttribute(Doctrine::ATTR_DEFAULT_TEXTFLD_LENGTH).')')
: ($length ? 'VARCHAR('.$length.')' : 'TEXT'); : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
case 'clob': case 'clob':
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 255) { if ($length <= 255) {
return 'TINYTEXT'; return 'TINYTEXT';
@ -87,7 +87,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
} }
return 'LONGTEXT'; return 'LONGTEXT';
case 'blob': case 'blob':
if (!empty($field['length'])) { if ( ! empty($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 255) { if ($length <= 255) {
return 'TINYBLOB'; return 'TINYBLOB';
@ -274,7 +274,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
$autoincrement = isset($field['autoincrement']) && $field['autoincrement']; $autoincrement = isset($field['autoincrement']) && $field['autoincrement'];
if ($autoincrement){ if ($autoincrement) {
$autoinc = ' PRIMARY KEY AUTOINCREMENT'; $autoinc = ' PRIMARY KEY AUTOINCREMENT';
$type = 'INTEGER'; $type = 'INTEGER';
} elseif (array_key_exists('default', $field)) { } elseif (array_key_exists('default', $field)) {

View File

@ -34,16 +34,16 @@ class Doctrine_DataType
{ {
public function __construct() public function __construct()
{ {
} }
public function getName() public function getName()
{ {
} }
public function getDefaultLength() public function getDefaultLength()
{ {
} }
} }

View File

@ -264,7 +264,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/ */
public function createTable($name, array $fields, array $options = array()) public function createTable($name, array $fields, array $options = array())
{ {
$sql = (array) $this->createTableSql($name, $fields, $options); $sql = (array) $this->createTableSql($name, $fields, $options);
foreach ($sql as $query) { foreach ($sql as $query) {
$this->conn->execute($query); $this->conn->execute($query);
@ -423,7 +423,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$name = $this->conn->quoteIdentifier($name); $name = $this->conn->quoteIdentifier($name);
$type = ''; $type = '';
if(isset($definition['type'])) { if (isset($definition['type'])) {
switch (strtolower($definition['type'])) { switch (strtolower($definition['type'])) {
case 'unique': case 'unique':
$type = strtoupper($definition['type']) . ' '; $type = strtoupper($definition['type']) . ' ';
@ -760,9 +760,9 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/ */
public function getIndexFieldDeclarationList(array $fields) public function getIndexFieldDeclarationList(array $fields)
{ {
$ret = array(); $ret = array();
foreach ($fields as $field => $definition) { foreach ($fields as $field => $definition) {
if(is_array($definition)) { if (is_array($definition)) {
$ret[] = $this->conn->quoteIdentifier($field); $ret[] = $this->conn->quoteIdentifier($field);
} else { } else {
$ret[] = $this->conn->quoteIdentifier($definition); $ret[] = $this->conn->quoteIdentifier($definition);
@ -868,7 +868,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/ */
public function getForeignKeyReferentialAction($action) public function getForeignKeyReferentialAction($action)
{ {
$upper = strtoupper($action); $upper = strtoupper($action);
switch ($upper) { switch ($upper) {
case 'CASCADE': case 'CASCADE':
case 'SET NULL': case 'SET NULL':
@ -891,7 +891,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/ */
public function getForeignKeyBaseDeclaration(array $definition) public function getForeignKeyBaseDeclaration(array $definition)
{ {
$sql = ''; $sql = '';
if (isset($definition['name'])) { if (isset($definition['name'])) {
$sql .= 'CONSTRAINT ' . $this->conn->quoteIdentifier($definition['name']) . ' '; $sql .= 'CONSTRAINT ' . $this->conn->quoteIdentifier($definition['name']) . ' ';
} }
@ -982,7 +982,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$this->conn->exec($query); $this->conn->exec($query);
} catch (Doctrine_Connection_Exception $e) { } catch (Doctrine_Connection_Exception $e) {
// we only want to silence table already exists errors // we only want to silence table already exists errors
if($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) {
$this->conn->rollback(); $this->conn->rollback();
throw $e; throw $e;
} }
@ -1010,7 +1010,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$this->conn->exec($query); $this->conn->exec($query);
} catch (Doctrine_Connection_Exception $e) { } catch (Doctrine_Connection_Exception $e) {
// we only want to silence table already exists errors // we only want to silence table already exists errors
if($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) {
$this->conn->rollback(); $this->conn->rollback();
throw $e; throw $e;
} }
@ -1093,10 +1093,10 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/ */
public function exportSql($directory = null) public function exportSql($directory = null)
{ {
$declared = get_declared_classes(); $declared = get_declared_classes();
if ($directory !== null) { if ($directory !== null) {
foreach ((array) $directory as $dir) { foreach ((array) $directory as $dir) {
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir),
RecursiveIteratorIterator::LEAVES_ONLY); RecursiveIteratorIterator::LEAVES_ONLY);
@ -1123,8 +1123,8 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/ */
public function exportTable(Doctrine_Table $table) public function exportTable(Doctrine_Table $table)
{ {
/** /**
TODO: maybe there should be portability option for the following check TODO: maybe there should be portability option for the following check
if ( ! Doctrine::isValidClassname($table->getOption('declaringClass')->getName())) { if ( ! Doctrine::isValidClassname($table->getOption('declaringClass')->getName())) {
throw new Doctrine_Export_Exception('Class name not valid.'); throw new Doctrine_Export_Exception('Class name not valid.');
} }
@ -1136,7 +1136,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$this->conn->export->createTable($data['tableName'], $data['columns'], $data['options']); $this->conn->export->createTable($data['tableName'], $data['columns'], $data['options']);
} catch(Doctrine_Connection_Exception $e) { } catch(Doctrine_Connection_Exception $e) {
// we only want to silence table already exists errors // we only want to silence table already exists errors
if($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) {
throw $e; throw $e;
} }
} }

View File

@ -321,7 +321,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
return true; return true;
} }
$query = ''; $query = '';
if (!empty($changes['add']) && is_array($changes['add'])) { if ( ! empty($changes['add']) && is_array($changes['add'])) {
foreach ($changes['add'] as $fieldName => $field) { foreach ($changes['add'] as $fieldName => $field) {
if ($query) { if ($query) {
$query.= ', '; $query.= ', ';
@ -330,7 +330,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
} }
} }
if (!empty($changes['remove']) && is_array($changes['remove'])) { if ( ! empty($changes['remove']) && is_array($changes['remove'])) {
foreach ($changes['remove'] as $field_name => $field) { foreach ($changes['remove'] as $field_name => $field) {
if ($query) { if ($query) {
$query.= ', '; $query.= ', ';
@ -340,7 +340,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
} }
} }
if (!empty($changes['rename']) && is_array($changes['rename'])) { if ( ! empty($changes['rename']) && is_array($changes['rename'])) {
foreach ($changes['rename'] as $field_name => $field) { foreach ($changes['rename'] as $field_name => $field) {
if ($query) { if ($query) {
$query.= ', '; $query.= ', ';
@ -350,7 +350,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
} }
} }
if (!empty($changes['change']) && is_array($changes['change'])) { if ( ! empty($changes['change']) && is_array($changes['change'])) {
// missing support to change DEFAULT and NULLability // missing support to change DEFAULT and NULLability
foreach ($changes['change'] as $fieldName => $field) { foreach ($changes['change'] as $fieldName => $field) {
$this->checkSupportedChanges($field); $this->checkSupportedChanges($field);
@ -363,7 +363,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
} }
} }
if (!strlen($query)) { if ( ! strlen($query)) {
return false; return false;
} }
@ -409,7 +409,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
$query_sort = ''; $query_sort = '';
foreach ($definition['fields'] as $field) { foreach ($definition['fields'] as $field) {
if (!strcmp($query_sort, '') && isset($field['sorting'])) { if ( ! strcmp($query_sort, '') && isset($field['sorting'])) {
switch ($field['sorting']) { switch ($field['sorting']) {
case 'ascending': case 'ascending':
$query_sort = ' ASC'; $query_sort = ' ASC';
@ -456,18 +456,18 @@ class Doctrine_Export_Firebird extends Doctrine_Export
{ {
$table = $this->conn->quoteIdentifier($table, true); $table = $this->conn->quoteIdentifier($table, true);
if (!empty($name)) { if ( ! empty($name)) {
$name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), true); $name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), true);
} }
$query = "ALTER TABLE $table ADD"; $query = "ALTER TABLE $table ADD";
if (!empty($definition['primary'])) { if ( ! empty($definition['primary'])) {
if (!empty($name)) { if ( ! empty($name)) {
$query.= ' CONSTRAINT '.$name; $query.= ' CONSTRAINT '.$name;
} }
$query.= ' PRIMARY KEY'; $query.= ' PRIMARY KEY';
} else { } else {
$query.= ' CONSTRAINT '. $name; $query.= ' CONSTRAINT '. $name;
if (!empty($definition['unique'])) { if ( ! empty($definition['unique'])) {
$query.= ' UNIQUE'; $query.= ' UNIQUE';
} }
} }

View File

@ -159,7 +159,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
*/ */
public function alterTable($name, array $changes, $check) public function alterTable($name, array $changes, $check)
{ {
foreach ($changes as $changeName => $change){ foreach ($changes as $changeName => $change) {
switch ($changeName) { switch ($changeName) {
case 'add': case 'add':
case 'remove': case 'remove':
@ -177,12 +177,12 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
} }
$query = ''; $query = '';
if (!empty($changes['name'])) { if ( ! empty($changes['name'])) {
$changeName = $this->conn->quoteIdentifier($changes['name'], true); $changeName = $this->conn->quoteIdentifier($changes['name'], true);
$query .= 'RENAME TO ' . $changeName; $query .= 'RENAME TO ' . $changeName;
} }
if (!empty($changes['add']) && is_array($changes['add'])) { if ( ! empty($changes['add']) && is_array($changes['add'])) {
foreach ($changes['add'] as $fieldName => $field) { foreach ($changes['add'] as $fieldName => $field) {
if ($query) { if ($query) {
$query.= ', '; $query.= ', ';
@ -191,7 +191,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
} }
} }
if (!empty($changes['remove']) && is_array($changes['remove'])) { if ( ! empty($changes['remove']) && is_array($changes['remove'])) {
foreach ($changes['remove'] as $fieldName => $field) { foreach ($changes['remove'] as $fieldName => $field) {
if ($query) { if ($query) {
$query.= ', '; $query.= ', ';
@ -202,13 +202,13 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
} }
$rename = array(); $rename = array();
if (!empty($changes['rename']) && is_array($changes['rename'])) { if ( ! empty($changes['rename']) && is_array($changes['rename'])) {
foreach ($changes['rename'] as $fieldName => $field) { foreach ($changes['rename'] as $fieldName => $field) {
$rename[$field['name']] = $fieldName; $rename[$field['name']] = $fieldName;
} }
} }
if (!empty($changes['change']) && is_array($changes['change'])) { if ( ! empty($changes['change']) && is_array($changes['change'])) {
foreach ($changes['change'] as $fieldName => $field) { foreach ($changes['change'] as $fieldName => $field) {
if ($query) { if ($query) {
$query.= ', '; $query.= ', ';
@ -224,7 +224,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
} }
} }
if (!empty($rename) && is_array($rename)) { if ( ! empty($rename) && is_array($rename)) {
foreach ($rename as $renamedFieldName => $renamed_field) { foreach ($rename as $renamedFieldName => $renamed_field) {
if ($query) { if ($query) {
$query.= ', '; $query.= ', ';
@ -235,7 +235,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
} }
} }
if (!$query) { if ( ! $query) {
return true; return true;
} }

View File

@ -164,7 +164,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
$optionStrings[] = 'ENGINE = ' . $type; $optionStrings[] = 'ENGINE = ' . $type;
} }
if (!empty($optionStrings)) { if ( ! empty($optionStrings)) {
$query.= ' '.implode(' ', $optionStrings); $query.= ' '.implode(' ', $optionStrings);
} }
$sql[] = $query; $sql[] = $query;
@ -524,7 +524,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
{ {
$name = $this->conn->quoteIdentifier($name); $name = $this->conn->quoteIdentifier($name);
$type = ''; $type = '';
if(isset($definition['type'])) { if (isset($definition['type'])) {
switch (strtolower($definition['type'])) { switch (strtolower($definition['type'])) {
case 'fulltext': case 'fulltext':
case 'unique': case 'unique':
@ -557,7 +557,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
*/ */
public function getIndexFieldDeclarationList(array $fields) public function getIndexFieldDeclarationList(array $fields)
{ {
$declFields = array(); $declFields = array();
foreach ($fields as $fieldName => $field) { foreach ($fields as $fieldName => $field) {
$fieldString = $fieldName; $fieldString = $fieldName;
@ -596,13 +596,13 @@ class Doctrine_Export_Mysql extends Doctrine_Export
public function getAdvancedForeignKeyOptions(array $definition) public function getAdvancedForeignKeyOptions(array $definition)
{ {
$query = ''; $query = '';
if (!empty($definition['match'])) { if ( ! empty($definition['match'])) {
$query .= ' MATCH ' . $definition['match']; $query .= ' MATCH ' . $definition['match'];
} }
if (!empty($definition['onUpdate'])) { if ( ! empty($definition['onUpdate'])) {
$query .= ' ON UPDATE ' . $this->getForeignKeyReferentialAction($definition['onUpdate']); $query .= ' ON UPDATE ' . $this->getForeignKeyReferentialAction($definition['onUpdate']);
} }
if (!empty($definition['onDelete'])) { if ( ! empty($definition['onDelete'])) {
$query .= ' ON DELETE ' . $this->getForeignKeyReferentialAction($definition['onDelete']); $query .= ' ON DELETE ' . $this->getForeignKeyReferentialAction($definition['onDelete']);
} }
return $query; return $query;

View File

@ -93,7 +93,7 @@ class Doctrine_Export_Oracle extends Doctrine_Export
*/ */
public function _makeAutoincrement($name, $table, $start = 1) public function _makeAutoincrement($name, $table, $start = 1)
{ {
$sql = array(); $sql = array();
$table = strtoupper($table); $table = strtoupper($table);
$indexName = $table . '_AI_PK'; $indexName = $table . '_AI_PK';
$definition = array( $definition = array(

View File

@ -232,7 +232,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
$query = 'ALTER ' . $fieldName . ' SET DEFAULT ' . $this->conn->quote($field['definition']['default'], $field['definition']['type']); $query = 'ALTER ' . $fieldName . ' SET DEFAULT ' . $this->conn->quote($field['definition']['default'], $field['definition']['type']);
$this->conn->exec('ALTER TABLE ' . $name . ' ' . $query); $this->conn->exec('ALTER TABLE ' . $name . ' ' . $query);
} }
if (!empty($field['notnull'])) { if ( ! empty($field['notnull'])) {
$query = 'ALTER ' . $fieldName . ' ' . ($field['definition']['notnull'] ? 'SET' : 'DROP') . ' NOT NULL'; $query = 'ALTER ' . $fieldName . ' ' . ($field['definition']['notnull'] ? 'SET' : 'DROP') . ' NOT NULL';
$this->conn->exec('ALTER TABLE ' . $name . ' ' . $query); $this->conn->exec('ALTER TABLE ' . $name . ' ' . $query);
} }

View File

@ -44,7 +44,7 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
public function dropDatabase($name) public function dropDatabase($name)
{ {
$databaseFile = $this->conn->getDatabaseFile($name); $databaseFile = $this->conn->getDatabaseFile($name);
if (!@file_exists($databaseFile)) { if ( ! @file_exists($databaseFile)) {
throw new Doctrine_Export_Exception('database does not exist'); throw new Doctrine_Export_Exception('database does not exist');
} }
$result = @unlink($databaseFile); $result = @unlink($databaseFile);
@ -103,7 +103,7 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
*/ */
public function getIndexFieldDeclarationList(array $fields) public function getIndexFieldDeclarationList(array $fields)
{ {
$declFields = array(); $declFields = array();
foreach ($fields as $fieldName => $field) { foreach ($fields as $fieldName => $field) {
$fieldString = $fieldName; $fieldString = $fieldName;
@ -168,7 +168,7 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
$autoinc = false; $autoinc = false;
foreach($fields as $field) { foreach($fields as $field) {
if(isset($field['autoincrement']) && $field['autoincrement'] || if (isset($field['autoincrement']) && $field['autoincrement'] ||
(isset($field['autoinc']) && $field['autoinc'])) { (isset($field['autoinc']) && $field['autoinc'])) {
$autoinc = true; $autoinc = true;
break; break;

View File

@ -80,7 +80,7 @@ class Doctrine_Expression
public function parseClause($clause) public function parseClause($clause)
{ {
$e = Doctrine_Tokenizer::bracketExplode($clause, ' '); $e = Doctrine_Tokenizer::bracketExplode($clause, ' ');
foreach ($e as $k => $expr) { foreach ($e as $k => $expr) {
$e[$k] = $this->parseExpression($expr); $e[$k] = $this->parseExpression($expr);

View File

@ -296,7 +296,7 @@ class Doctrine_Expression_Driver extends Doctrine_Connection_Module
*/ */
public function concat() public function concat()
{ {
$args = func_get_args(); $args = func_get_args();
return 'CONCAT(' . join(', ', (array) $args) . ')'; return 'CONCAT(' . join(', ', (array) $args) . ')';
} }
@ -703,7 +703,7 @@ class Doctrine_Expression_Driver extends Doctrine_Connection_Module
*/ */
public function __call($m, $a) public function __call($m, $a)
{ {
if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_EXPR) { if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_EXPR) {
throw new Doctrine_Expression_Exception('Unknown expression ' . $m); throw new Doctrine_Expression_Exception('Unknown expression ' . $m);
} }
return $m . '(' . implode(', ', $a) . ')'; return $m . '(' . implode(', ', $a) . ')';

View File

@ -70,7 +70,7 @@ class Doctrine_Expression_Mysql extends Doctrine_Expression_Driver
public function matchPattern($pattern, $operator = null, $field = null) public function matchPattern($pattern, $operator = null, $field = null)
{ {
$match = ''; $match = '';
if (!is_null($operator)) { if ( ! is_null($operator)) {
$field = is_null($field) ? '' : $field.' '; $field = is_null($field) ? '' : $field.' ';
$operator = strtoupper($operator); $operator = strtoupper($operator);
switch ($operator) { switch ($operator) {

View File

@ -1,97 +1,97 @@
<?php <?php
/* /*
* $Id$ * $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
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* This software consists of voluntary contributions made by many individuals * This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see * and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>. * <http://www.phpdoctrine.com>.
*/ */
Doctrine::autoload('Doctrine_Expression_Driver'); Doctrine::autoload('Doctrine_Expression_Driver');
/** /**
* Doctrine_Expression_Pgsql * Doctrine_Expression_Pgsql
* *
* @package Doctrine * @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping * @category Object Relational Mapping
* @link www.phpdoctrine.com * @link www.phpdoctrine.com
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/ */
class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver
{ {
/** /**
* Returns the md5 sum of a field. * Returns the md5 sum of a field.
* *
* Note: Not SQL92, but common functionality * Note: Not SQL92, but common functionality
* *
* md5() works with the default PostgreSQL 8 versions. * md5() works with the default PostgreSQL 8 versions.
* *
* If you are using PostgreSQL 7.x or older you need * If you are using PostgreSQL 7.x or older you need
* to make sure that the digest procedure is installed. * to make sure that the digest procedure is installed.
* If you use RPMS (Redhat and Mandrake) install the postgresql-contrib * If you use RPMS (Redhat and Mandrake) install the postgresql-contrib
* package. You must then install the procedure by running this shell command: * package. You must then install the procedure by running this shell command:
* <code> * <code>
* psql [dbname] < /usr/share/pgsql/contrib/pgcrypto.sql * psql [dbname] < /usr/share/pgsql/contrib/pgcrypto.sql
* </code> * </code>
* You should make sure you run this as the postgres user. * You should make sure you run this as the postgres user.
* *
* @return string * @return string
*/ */
public function md5($column) public function md5($column)
{ {
$column = $this->getIdentifier($column); $column = $this->getIdentifier($column);
if ($this->version > 7) { if ($this->version > 7) {
return 'MD5(' . $column . ')'; return 'MD5(' . $column . ')';
} else { } else {
return 'encode(digest(' . $column .', md5), hex)'; return 'encode(digest(' . $column .', md5), hex)';
} }
} }
/** /**
* Returns part of a string. * Returns part of a string.
* *
* Note: Not SQL92, but common functionality. * Note: Not SQL92, but common functionality.
* *
* @param string $value the target $value the string or the string column. * @param string $value the target $value the string or the string column.
* @param int $from extract from this characeter. * @param int $from extract from this characeter.
* @param int $len extract this amount of characters. * @param int $len extract this amount of characters.
* @return string sql that extracts part of a string. * @return string sql that extracts part of a string.
*/ */
public function substring($value, $from, $len = null) public function substring($value, $from, $len = null)
{ {
$value = $this->getIdentifier($value); $value = $this->getIdentifier($value);
if ($len === null) { if ($len === null) {
$len = $this->getIdentifier($len); $len = $this->getIdentifier($len);
return 'SUBSTR(' . $value . ', ' . $from . ')'; return 'SUBSTR(' . $value . ', ' . $from . ')';
} else { } else {
return 'SUBSTR(' . $value . ', ' . $from . ', ' . $len . ')'; return 'SUBSTR(' . $value . ', ' . $from . ', ' . $len . ')';
} }
} }
/** /**
* Returns a series of strings concatinated * Returns a series of strings concatinated
* *
* concat() accepts an arbitrary number of parameters. Each parameter * concat() accepts an arbitrary number of parameters. Each parameter
* must contain an expression or an array with expressions. * must contain an expression or an array with expressions.
* *
* @param string|array(string) strings that will be concatinated. * @param string|array(string) strings that will be concatinated.
* @return string * @return string
*/ */
/** /**
@ -102,10 +102,10 @@ class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver
* @return string * @return string
*/ */
public function age($timestamp1, $timestamp2 = null) { public function age($timestamp1, $timestamp2 = null) {
if( $timestamp2 == null ) { if ( $timestamp2 == null ) {
return 'AGE(' . $timestamp1 . ')'; return 'AGE(' . $timestamp1 . ')';
} }
return 'AGE(' . $timestamp1 . ', ' . $timestamp2 . ')'; return 'AGE(' . $timestamp1 . ', ' . $timestamp2 . ')';
} }
/** /**
@ -116,90 +116,90 @@ class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver
* @return string * @return string
*/ */
public function date_part($text, $time) { public function date_part($text, $time) {
return 'DATE_PART(' . $text . ', ' . $time . ')'; return 'DATE_PART(' . $text . ', ' . $time . ')';
} }
public function concat() public function concat()
{ {
$args = func_get_args(); $args = func_get_args();
return join(' || ' , $args); return join(' || ' , $args);
} }
/** /**
* Returns the SQL string to return the current system date and time. * Returns the SQL string to return the current system date and time.
* *
* @return string * @return string
*/ */
public function now() public function now()
{ {
return 'LOCALTIMESTAMP(0)'; return 'LOCALTIMESTAMP(0)';
} }
/** /**
* regexp * regexp
* *
* @return string the regular expression operator * @return string the regular expression operator
*/ */
public function regexp() public function regexp()
{ {
return 'SIMILAR TO'; return 'SIMILAR TO';
} }
/** /**
* return string to call a function to get random value inside an SQL statement * return string to call a function to get random value inside an SQL statement
* *
* @return return string to generate float between 0 and 1 * @return return string to generate float between 0 and 1
* @access public * @access public
*/ */
public function random() public function random()
{ {
return 'RANDOM()'; return 'RANDOM()';
} }
/** /**
* build a pattern matching string * build a pattern matching string
* *
* EXPERIMENTAL * EXPERIMENTAL
* *
* WARNING: this function is experimental and may change signature at * WARNING: this function is experimental and may change signature at
* any time until labelled as non-experimental * any time until labelled as non-experimental
* *
* @access public * @access public
* *
* @param array $pattern even keys are strings, odd are patterns (% and _) * @param array $pattern even keys are strings, odd are patterns (% and _)
* @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future) * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future)
* @param string $field optional field name that is being matched against * @param string $field optional field name that is being matched against
* (might be required when emulating ILIKE) * (might be required when emulating ILIKE)
* *
* @return string SQL pattern * @return string SQL pattern
*/ */
public function matchPattern($pattern, $operator = null, $field = null) public function matchPattern($pattern, $operator = null, $field = null)
{ {
$match = ''; $match = '';
if (!is_null($operator)) { if ( ! is_null($operator)) {
$field = is_null($field) ? '' : $field.' '; $field = is_null($field) ? '' : $field.' ';
$operator = strtoupper($operator); $operator = strtoupper($operator);
switch ($operator) { switch ($operator) {
// case insensitive // case insensitive
case 'ILIKE': case 'ILIKE':
$match = $field.'ILIKE '; $match = $field.'ILIKE ';
break; break;
// case sensitive // case sensitive
case 'LIKE': case 'LIKE':
$match = $field.'LIKE '; $match = $field.'LIKE ';
break; break;
default: default:
throw new Doctrine_Expression_Pgsql_Exception('not a supported operator type:'. $operator); throw new Doctrine_Expression_Pgsql_Exception('not a supported operator type:'. $operator);
} }
} }
$match.= "'"; $match.= "'";
foreach ($pattern as $key => $value) { foreach ($pattern as $key => $value) {
if ($key % 2) { if ($key % 2) {
$match.= $value; $match.= $value;
} else { } else {
$match.= $this->conn->escapePattern($this->conn->escape($value)); $match.= $this->conn->escapePattern($this->conn->escape($value));
} }
} }
$match.= "'"; $match.= "'";
$match.= $this->patternEscapeString(); $match.= $this->patternEscapeString();
return $match; return $match;
} }
} }

View File

@ -71,7 +71,7 @@ class Doctrine_Formatter extends Doctrine_Connection_Module
*/ */
public function convertBooleans($item) public function convertBooleans($item)
{ {
if (is_array($item)) { if (is_array($item)) {
foreach ($item as $k => $value) { foreach ($item as $k => $value) {
if (is_bool($value)) { if (is_bool($value)) {
$item[$k] = (int) $value; $item[$k] = (int) $value;

View File

@ -81,7 +81,7 @@ class Doctrine_Hook
} elseif ($query instanceof Doctrine_Query) { } elseif ($query instanceof Doctrine_Query) {
$this->query = $query; $this->query = $query;
} else { } else {
throw new Doctrine_Exception('Constructor argument should be either Doctrine_Query object or valid DQL query'); throw new Doctrine_Exception('Constructor argument should be either Doctrine_Query object or valid DQL query');
} }
$this->query->getQuery(); $this->query->getQuery();

View File

@ -184,7 +184,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
*/ */
public function getRootAlias() public function getRootAlias()
{ {
if (!$this->_aliasMap) { if ( ! $this->_aliasMap) {
$this->getSql(); $this->getSql();
} }

View File

@ -51,14 +51,14 @@ class Doctrine_Hydrate_Array
} }
public function initRelated(array &$data, $name) public function initRelated(array &$data, $name)
{ {
if ( ! isset($data[$name])) { if ( ! isset($data[$name])) {
$data[$name] = array(); $data[$name] = array();
} }
return true; return true;
} }
public function getNullPointer() public function getNullPointer()
{ {
return null; return null;
} }
public function search(array $element, array $data) public function search(array $element, array $data)
{ {
@ -77,6 +77,6 @@ class Doctrine_Hydrate_Array
} }
public function flush() public function flush()
{ {
} }
} }

View File

@ -52,7 +52,7 @@ class Doctrine_Hydrate_Record extends Doctrine_Object
} }
public function initRelated($record, $name) public function initRelated($record, $name)
{ {
if ( ! is_array($record)) { if ( ! is_array($record)) {
$record[$name]; $record[$name];
return true; return true;
@ -74,7 +74,7 @@ class Doctrine_Hydrate_Record extends Doctrine_Object
*/ */
public function isIdentifiable(array $row, Doctrine_Table $table) public function isIdentifiable(array $row, Doctrine_Table $table)
{ {
$primaryKeys = $table->getIdentifier(); $primaryKeys = $table->getIdentifier();
if (is_array($primaryKeys)) { if (is_array($primaryKeys)) {
foreach ($primaryKeys as $id) { foreach ($primaryKeys as $id) {
@ -95,7 +95,7 @@ class Doctrine_Hydrate_Record extends Doctrine_Object
} }
public function getElement(array $data, $component) public function getElement(array $data, $component)
{ {
if ( ! isset($this->_tables[$component])) { if ( ! isset($this->_tables[$component])) {
$this->_tables[$component] = Doctrine_Manager::getInstance()->getTable($component); $this->_tables[$component] = Doctrine_Manager::getInstance()->getTable($component);
$this->_tables[$component]->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, false); $this->_tables[$component]->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, false);
} }

View File

@ -165,8 +165,8 @@ END;
} }
public function buildRelationDefinition(array $relations) public function buildRelationDefinition(array $relations)
{ {
$ret = array(); $ret = array();
$i = 0; $i = 0;
foreach ($relations as $name => $relation) { foreach ($relations as $name => $relation) {
$alias = (isset($relation['alias']) && $relation['alias'] !== $name) ? ' as ' . $relation['alias'] : ''; $alias = (isset($relation['alias']) && $relation['alias'] !== $name) ? ' as ' . $relation['alias'] : '';
@ -211,9 +211,9 @@ END;
public function buildDefinition(array $options, array $columns, array $relations = array()) public function buildDefinition(array $options, array $columns, array $relations = array())
{ {
if ( ! isset($options['className'])) { if ( ! isset($options['className'])) {
throw new Doctrine_Import_Builder_Exception('Missing class name.'); throw new Doctrine_Import_Builder_Exception('Missing class name.');
} }
//$opt = array(0 => str_repeat(' ', 8) . '$this->setTableName(\''. $table .'\');'); //$opt = array(0 => str_repeat(' ', 8) . '$this->setTableName(\''. $table .'\');');
@ -226,9 +226,9 @@ END;
public function buildRecord($options, $columns, $relations) public function buildRecord($options, $columns, $relations)
{ {
if ( ! isset($options['className'])) { if ( ! isset($options['className'])) {
throw new Doctrine_Import_Builder_Exception('Missing class name.'); throw new Doctrine_Import_Builder_Exception('Missing class name.');
} }
if ( ! isset($options['fileName'])) { if ( ! isset($options['fileName'])) {
if (empty($this->path)) { if (empty($this->path)) {

View File

@ -31,16 +31,16 @@ Doctrine::autoload('Doctrine_Import');
*/ */
class Doctrine_Import_Informix extends Doctrine_Import class Doctrine_Import_Informix extends Doctrine_Import
{ {
protected $sql = array( protected $sql = array(
'listTables' => "SELECT tabname,tabtype FROM systables WHERE tabtype IN ('T','V') AND owner != 'informix'", 'listTables' => "SELECT tabname,tabtype FROM systables WHERE tabtype IN ('T','V') AND owner != 'informix'",
'listColumns' => "SELECT c.colname, c.coltype, c.collength, d.default, c.colno 'listColumns' => "SELECT c.colname, c.coltype, c.collength, d.default, c.colno
FROM syscolumns c, systables t,outer sysdefaults d FROM syscolumns c, systables t,outer sysdefaults d
WHERE c.tabid = t.tabid AND d.tabid = t.tabid AND d.colno = c.colno WHERE c.tabid = t.tabid AND d.tabid = t.tabid AND d.colno = c.colno
AND tabname='%s' ORDER BY c.colno", AND tabname='%s' ORDER BY c.colno",
'listPk' => "SELECT part1, part2, part3, part4, part5, part6, part7, part8 FROM 'listPk' => "SELECT part1, part2, part3, part4, part5, part6, part7, part8 FROM
systables t, sysconstraints s, sysindexes i WHERE t.tabname='%s' systables t, sysconstraints s, sysindexes i WHERE t.tabname='%s'
AND s.tabid=t.tabid AND s.constrtype='P' AND s.tabid=t.tabid AND s.constrtype='P'
AND i.idxname=s.idxname", AND i.idxname=s.idxname",
'listForeignKeys' => "SELECT tr.tabname,updrule,delrule, 'listForeignKeys' => "SELECT tr.tabname,updrule,delrule,
i.part1 o1,i2.part1 d1,i.part2 o2,i2.part2 d2,i.part3 o3,i2.part3 d3,i.part4 o4,i2.part4 d4, i.part1 o1,i2.part1 d1,i.part2 o2,i2.part2 d2,i.part3 o3,i2.part3 d3,i.part4 o4,i2.part4 d4,
i.part5 o5,i2.part5 d5,i.part6 o6,i2.part6 d6,i.part7 o7,i2.part7 d7,i.part8 o8,i2.part8 d8 i.part5 o5,i2.part5 d5,i.part6 o6,i2.part6 d6,i.part7 o7,i2.part7 d7,i.part8 o8,i2.part8 d8

View File

@ -170,7 +170,7 @@ class Doctrine_Import_Mssql extends Doctrine_Import
$result = array(); $result = array();
foreach ($indexes as $index) { foreach ($indexes as $index) {
if (!in_array($index, $pkAll) && $index != null) { if ( ! in_array($index, $pkAll) && $index != null) {
$result[] = $this->conn->formatter->fixIndexName($index); $result[] = $this->conn->formatter->fixIndexName($index);
} }
} }

View File

@ -48,7 +48,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import
public function listSequences($database = null) public function listSequences($database = null)
{ {
$query = 'SHOW TABLES'; $query = 'SHOW TABLES';
if (!is_null($database)) { if ( ! is_null($database)) {
$query .= ' FROM ' . $database; $query .= ' FROM ' . $database;
} }
$tableNames = $this->conn->fetchColumn($query); $tableNames = $this->conn->fetchColumn($query);
@ -81,7 +81,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import
$result = array(); $result = array();
foreach ($indexes as $indexData) { foreach ($indexes as $indexData) {
if (!$indexData[$nonUnique]) { if ( ! $indexData[$nonUnique]) {
if ($indexData[$keyName] !== 'PRIMARY') { if ($indexData[$keyName] !== 'PRIMARY') {
$index = $this->conn->fixIndexName($indexData[$keyName]); $index = $this->conn->fixIndexName($indexData[$keyName]);
} else { } else {
@ -102,7 +102,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import
*/ */
public function listTableForeignKeys($table) public function listTableForeignKeys($table)
{ {
$sql = 'SHOW CREATE TABLE ' . $this->conn->quoteIdentifier($table, true); $sql = 'SHOW CREATE TABLE ' . $this->conn->quoteIdentifier($table, true);
} }
/** /**
* lists table constraints * lists table constraints
@ -195,7 +195,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import
*/ */
public function listViews($database = null) public function listViews($database = null)
{ {
if (!is_null($database)) { if ( ! is_null($database)) {
$query = sprintf($this->sql['listViews'], ' FROM ' . $database); $query = sprintf($this->sql['listViews'], ' FROM ' . $database);
} }

View File

@ -197,7 +197,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import
*/ */
public function listUsers() public function listUsers()
{ {
/** /**
if ($this->conn->options['emulate_database'] && $this->conn->options['database_name_prefix']) { if ($this->conn->options['emulate_database'] && $this->conn->options['database_name_prefix']) {
$query = 'SELECT SUBSTR(username, '; $query = 'SELECT SUBSTR(username, ';
$query.= (strlen($this->conn->options['database_name_prefix'])+1); $query.= (strlen($this->conn->options['database_name_prefix'])+1);

View File

@ -79,16 +79,16 @@ class Doctrine_Import_Reader_Db extends Doctrine_Import_Reader
$this->conn->set("name",$dbName); $this->conn->set("name",$dbName);
$tableNames = $dataDict->listTables(); $tableNames = $dataDict->listTables();
foreach ($tableNames as $tableName){ foreach ($tableNames as $tableName) {
$table = new Doctrine_Schema_Table(); $table = new Doctrine_Schema_Table();
$table->set("name",$tableName); $table->set("name",$tableName);
$tableColumns = $dataDict->listTableColumns($tableName); $tableColumns = $dataDict->listTableColumns($tableName);
foreach ($tableColumns as $tableColumn){ foreach ($tableColumns as $tableColumn) {
$table->addColumn($tableColumn); $table->addColumn($tableColumn);
} }
$this->conn->addTable($table); $this->conn->addTable($table);
if ($fks = $dataDict->listTableConstraints($tableName)){ if ($fks = $dataDict->listTableConstraints($tableName)) {
foreach ($fks as $fk){ foreach ($fks as $fk) {
$relation = new Doctrine_Schema_Relation(); $relation = new Doctrine_Schema_Relation();
$relation->setRelationBetween($fk['referencingColumn'],$fk['referencedTable'],$fk['referencedColumn']); $relation->setRelationBetween($fk['referencingColumn'],$fk['referencedTable'],$fk['referencedColumn']);
$table->setRelation($relation); $table->setRelation($relation);

View File

@ -39,19 +39,19 @@
*/ */
class Doctrine_Import_Schema_Xml extends Doctrine_Import_Schema class Doctrine_Import_Schema_Xml extends Doctrine_Import_Schema
{ {
/** /**
* parse * parse
* *
* @param string $schema * @param string $schema
* @return void * @return void
*/ */
public function parse($schema) public function parse($schema)
{ {
if (!is_readable($schema)) { if ( ! is_readable($schema)) {
throw new Doctrine_Import_Exception('Could not read schema file '. $schema); throw new Doctrine_Import_Exception('Could not read schema file '. $schema);
} }
if (!($xmlString = file_get_contents($schema))) { if ( ! ($xmlString = file_get_contents($schema))) {
throw new Doctrine_Import_Exception('Schema file '. $schema . ' is empty'); throw new Doctrine_Import_Exception('Schema file '. $schema . ' is empty');
} }
@ -101,4 +101,4 @@ class Doctrine_Import_Schema_Xml extends Doctrine_Import_Schema
return $tables; return $tables;
} }
} }

View File

@ -39,19 +39,19 @@
*/ */
class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
{ {
/** /**
* parse * parse
* *
* @param string $schema * @param string $schema
* @return void * @return void
*/ */
public function parse($schema) public function parse($schema)
{ {
if (!is_readable($schema)) { if ( ! is_readable($schema)) {
throw new Doctrine_Import_Exception('Could not read schema file '. $schema); throw new Doctrine_Import_Exception('Could not read schema file '. $schema);
} }
return array(); return array();
} }
/** /**
@ -66,11 +66,11 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
public function parseSchema($schema) public function parseSchema($schema)
{ {
$array = $this->parse($schema); $array = $this->parse($schema);
$tables = array(); $tables = array();
// Not working yet // Not working yet
/* /*
// Go through all tables... // Go through all tables...
foreach ($array['table'] as $table) { foreach ($array['table'] as $table) {
// Go through all columns... // Go through all columns...
@ -93,8 +93,8 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
$tables[(string) $table['name']] = $columns; $tables[(string) $table['name']] = $columns;
} }
*/ */
return $tables; return $tables;
} }
} }

View File

@ -40,7 +40,7 @@ class Doctrine_IntegrityMapper
} }
public function invokeIntegrityActions(Doctrine_Record $record) public function invokeIntegrityActions(Doctrine_Record $record)
{ {
$deleteActions = Doctrine_Manager::getInstance() $deleteActions = Doctrine_Manager::getInstance()
->getDeleteActions($record->getTable()->getComponentName()); ->getDeleteActions($record->getTable()->getComponentName());
foreach ($record->getTable()->getRelations() as $relation) { foreach ($record->getTable()->getRelations() as $relation) {
@ -97,7 +97,7 @@ class Doctrine_IntegrityMapper
} }
public function buildIntegrityRelations(Doctrine_Table $table, &$aliases, &$fields, &$indexes, &$components) public function buildIntegrityRelations(Doctrine_Table $table, &$aliases, &$fields, &$indexes, &$components)
{ {
$deleteActions = Doctrine_Manager::getInstance() $deleteActions = Doctrine_Manager::getInstance()
->getDeleteActions($table->getComponentName()); ->getDeleteActions($table->getComponentName());
foreach ($table->getRelations() as $relation) { foreach ($table->getRelations() as $relation) {

View File

@ -83,7 +83,7 @@ class Doctrine_Lib
* @return string Xml as string * @return string Xml as string
*/ */
public static function getCollectionAsXml(Doctrine_Collection $collection, SimpleXMLElement $incomming_xml = null){ public static function getCollectionAsXml(Doctrine_Collection $collection, SimpleXMLElement $incomming_xml = null) {
$collectionName = Doctrine_Lib::plurelize($collection->getTable()->tableName); $collectionName = Doctrine_Lib::plurelize($collection->getTable()->tableName);
if ( $collection->count != 0) { if ( $collection->count != 0) {
@ -106,7 +106,7 @@ class Doctrine_Lib
return $xml->asXML(); return $xml->asXML();
} }
public static function plurelize($string){ public static function plurelize($string) {
return $string . "s"; return $string . "s";
} }
@ -131,10 +131,10 @@ class Doctrine_Lib
if ( !isset($incomming_xml)) { if ( !isset($incomming_xml)) {
$new_xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><" . $recordname . "></" . $recordname . ">"; $new_xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><" . $recordname . "></" . $recordname . ">";
$xml = new SimpleXMLElement($new_xml_string); $xml = new SimpleXMLElement($new_xml_string);
}else{ } else {
$xml = $incomming_xml->addChild($recordname); $xml = $incomming_xml->addChild($recordname);
} }
foreach($record->obtainIdentifier() as $pk_field => $pk_value){ foreach($record->obtainIdentifier() as $pk_field => $pk_value) {
$xml->addChild($pk_field,$pk_value); $xml->addChild($pk_field,$pk_value);
} }
$xml_options = $record->option("xml"); $xml_options = $record->option("xml");
@ -145,12 +145,12 @@ class Doctrine_Lib
if ((isset($xml_options["ignore_fields"]) && !in_array($field, $xml_options["ignore_fields"])) || !isset($xml_options["ignore_fields"])) { if ((isset($xml_options["ignore_fields"]) && !in_array($field, $xml_options["ignore_fields"])) || !isset($xml_options["ignore_fields"])) {
if ($value instanceOf Doctrine_Null) { if ($value instanceOf Doctrine_Null) {
$xml->addChild($field); $xml->addChild($field);
} else { } else {
$xml->addChild($field, $value); $xml->addChild($field, $value);
} }
} }
} }
if (!isset($xml_options["include_relations"])) { if ( ! isset($xml_options["include_relations"])) {
return $xml->asXML(); return $xml->asXML();
} }
$relations = $record->getTable()->getRelations(); $relations = $record->getTable()->getRelations();

View File

@ -217,7 +217,7 @@ class Doctrine_Locking_Manager_Pessimistic
$stmt->bindParam(':object_key', $key); $stmt->bindParam(':object_key', $key);
$success = $stmt->execute(); $success = $stmt->execute();
if (!$success) { if ( ! $success) {
throw new Doctrine_Locking_Exception("Failed to determine locking user"); throw new Doctrine_Locking_Exception("Failed to determine locking user");
} }

View File

@ -190,7 +190,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/ */
public function openConnection($adapter, $name = null, $setCurrent = true) public function openConnection($adapter, $name = null, $setCurrent = true)
{ {
if (is_object($adapter)) { if (is_object($adapter)) {
if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) { if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) {
throw new Doctrine_Manager_Exception("First argument should be an instance of PDO or implement Doctrine_Adapter_Interface"); throw new Doctrine_Manager_Exception("First argument should be an instance of PDO or implement Doctrine_Adapter_Interface");
} }
@ -202,7 +202,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
} }
$e = explode(':', $adapter[0]); $e = explode(':', $adapter[0]);
if($e[0] == 'uri') { if ($e[0] == 'uri') {
$e[0] = 'odbc'; $e[0] = 'odbc';
} }

View File

@ -83,7 +83,7 @@ class Doctrine_Node implements IteratorAggregate
{ {
$class = 'Doctrine_Node_' . $implName; $class = 'Doctrine_Node_' . $implName;
if (!class_exists($class)) { if ( ! class_exists($class)) {
throw new Doctrine_Node_Exception("The class $class must exist and extend Doctrine_Node"); throw new Doctrine_Node_Exception("The class $class must exist and extend Doctrine_Node");
} }

View File

@ -750,7 +750,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
{ {
if ($record === null) { if ($record === null) {
return ($this->getRightValue() > $this->getLeftValue()); return ($this->getRightValue() > $this->getLeftValue());
} else if( $record instanceof Doctrine_Record ) { } else if ( $record instanceof Doctrine_Record ) {
return ($record->getNode()->getRightValue() > $record->getNode()->getLeftValue()); return ($record->getNode()->getRightValue() > $record->getNode()->getLeftValue());
} else { } else {
return false; return false;
@ -817,7 +817,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
// Make room in the new branch // Make room in the new branch
$this->shiftRLValues($destLeft, $treeSize, $rootId); $this->shiftRLValues($destLeft, $treeSize, $rootId);
if ($left >= $destLeft){ // src was shifted too? if ($left >= $destLeft) { // src was shifted too?
$left += $treeSize; $left += $treeSize;
$right += $treeSize; $right += $treeSize;
} }
@ -952,7 +952,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
*/ */
public function getLevel() public function getLevel()
{ {
if (!isset($this->record['level'])) { if ( ! isset($this->record['level'])) {
$baseAlias = $this->_tree->getBaseAlias(); $baseAlias = $this->_tree->getBaseAlias();
$componentName = $this->_tree->getBaseComponent(); $componentName = $this->_tree->getBaseComponent();
$q = $this->_tree->getBaseQuery(); $q = $this->_tree->getBaseQuery();

View File

@ -154,7 +154,7 @@ class Doctrine_Node_NestedSet_PreOrderIterator implements Iterator
private function updateLevel() private function updateLevel()
{ {
if (!(isset($this->options['include_record']) && $this->options['include_record'] && $this->index == 0)) { if ( ! (isset($this->options['include_record']) && $this->options['include_record'] && $this->index == 0)) {
$left = $this->collection->get($this->key)->getNode()->getLeftValue(); $left = $this->collection->get($this->key)->getNode()->getLeftValue();
$this->level += $this->prevLeft - $left + 2; $this->level += $this->prevLeft - $left + 2;
$this->prevLeft = $left; $this->prevLeft = $left;

View File

@ -36,10 +36,10 @@ final class Doctrine_Null
{ {
public function exists() public function exists()
{ {
return false; return false;
} }
public function __toString() public function __toString()
{ {
return ''; return '';
} }
} }

View File

@ -322,9 +322,9 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
*/ */
public function getDqlPart($queryPart) public function getDqlPart($queryPart)
{ {
if ( ! isset($this->_dqlParts[$queryPart])) { if ( ! isset($this->_dqlParts[$queryPart])) {
throw new Doctrine_Query_Exception('Unknown query part ' . $queryPart); throw new Doctrine_Query_Exception('Unknown query part ' . $queryPart);
} }
return $this->_dqlParts[$queryPart]; return $this->_dqlParts[$queryPart];
} }
@ -757,7 +757,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$aliases = array_merge($this->subqueryAliases, $aliases = array_merge($this->subqueryAliases,
array_keys($this->neededTables)); array_keys($this->neededTables));
if( ! in_array($e[3], $aliases) && if ( ! in_array($e[3], $aliases) &&
! in_array($e[2], $aliases) && ! in_array($e[2], $aliases) &&
! empty($this->pendingFields)) { ! empty($this->pendingFields)) {
@ -1217,7 +1217,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
public function load($path, $loadFields = true) public function load($path, $loadFields = true)
{ {
$e = Doctrine_Tokenizer::quoteExplode($path, ' INDEXBY '); $e = Doctrine_Tokenizer::quoteExplode($path, ' INDEXBY ');
$mapWith = null; $mapWith = null;
if (count($e) > 1) { if (count($e) > 1) {
@ -1322,7 +1322,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$assocTableName = $asf->getTableName(); $assocTableName = $asf->getTableName();
if( ! $loadFields || ! empty($map) || $joinCondition) { if ( ! $loadFields || ! empty($map) || $joinCondition) {
$this->subqueryAliases[] = $assocTableName; $this->subqueryAliases[] = $assocTableName;
} }
@ -1404,7 +1404,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$restoreState = true; $restoreState = true;
} }
if(isset($this->pendingFields[$componentAlias])) { if (isset($this->pendingFields[$componentAlias])) {
$this->processPendingFields($componentAlias); $this->processPendingFields($componentAlias);
} }

View File

@ -88,7 +88,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
$value = $value->getSql(); $value = $value->getSql();
unset($values[$k]); unset($values[$k]);
} else { } else {
$value = '?'; $value = '?';
} }
$a[] = $value; $a[] = $value;
} }
@ -184,7 +184,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
*/ */
public function delete() public function delete()
{ {
$this->type = self::DELETE; $this->type = self::DELETE;
return $this; return $this;
} }
@ -197,7 +197,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
*/ */
public function update($update) public function update($update)
{ {
$this->type = self::UPDATE; $this->type = self::UPDATE;
return $this->parseQueryPart('from', $update); return $this->parseQueryPart('from', $update);
} }
@ -210,11 +210,11 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
*/ */
public function set($key, $value, $params = null) public function set($key, $value, $params = null)
{ {
if (is_array($key)) { if (is_array($key)) {
foreach ($key as $k => $v) { foreach ($key as $k => $v) {
$this->set($k, '?', array($v)); $this->set($k, '?', array($v));
} }
} else { } else {
if ($params !== null) { if ($params !== null) {
if (is_array($params)) { if (is_array($params)) {
$this->_params['set'] = array_merge($this->_params['set'], $params); $this->_params['set'] = array_merge($this->_params['set'], $params);

View File

@ -38,7 +38,7 @@ class Doctrine_Query_JoinCondition extends Doctrine_Query_Condition
$e = Doctrine_Tokenizer::sqlExplode($condition); $e = Doctrine_Tokenizer::sqlExplode($condition);
if(count($e) > 2) { if (count($e) > 2) {
$a = explode('.', $e[0]); $a = explode('.', $e[0]);
$field = array_pop($a); $field = array_pop($a);
$reference = implode('.', $a); $reference = implode('.', $a);

View File

@ -68,7 +68,7 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition
$map = $this->query->getRootDeclaration(); $map = $this->query->getRootDeclaration();
$alias = $this->query->getTableAlias($this->query->getRootAlias()); $alias = $this->query->getTableAlias($this->query->getRootAlias());
$table = $map['table']; $table = $map['table'];
} else { } else {
$map = $this->query->load($reference, false); $map = $this->query->load($reference, false);
@ -129,7 +129,7 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition
} }
$value = '(' . implode(', ', $value) . ')'; $value = '(' . implode(', ', $value) . ')';
} }
} elseif(substr($value, 0, 1) == ':' || $value === '?') { } elseif (substr($value, 0, 1) == ':' || $value === '?') {
// placeholder found // placeholder found
if (isset($table) && isset($field) && $table->getTypeOf($field) == 'enum') { if (isset($table) && isset($field) && $table->getTypeOf($field) == 'enum') {
$this->query->addEnumParam($value, $table, $field); $this->query->addEnumParam($value, $table, $field);

View File

@ -129,7 +129,7 @@ class Doctrine_RawSql extends Doctrine_Query_Abstract
*/ */
public function getQuery() public function getQuery()
{ {
$select = array(); $select = array();
foreach ($this->fields as $field) { foreach ($this->fields as $field) {
$e = explode('.', $field); $e = explode('.', $field);

View File

@ -370,8 +370,8 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/ */
public function errorStack($stack = null) public function errorStack($stack = null)
{ {
if($stack !== null) { if ($stack !== null) {
if( ! ($stack instanceof Doctrine_Validator_ErrorStack)) { if ( ! ($stack instanceof Doctrine_Validator_ErrorStack)) {
throw new Doctrine_Record_Exception('Argument should be an instance of Doctrine_Validator_ErrorStack.'); throw new Doctrine_Record_Exception('Argument should be an instance of Doctrine_Validator_ErrorStack.');
} }
$this->_errorStack = $stack; $this->_errorStack = $stack;
@ -413,7 +413,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/ */
public function cleanData(&$data) public function cleanData(&$data)
{ {
$tmp = $data; $tmp = $data;
$data = array(); $data = array();
foreach ($this->getTable()->getColumnNames() as $name) { foreach ($this->getTable()->getColumnNames() as $name) {
@ -483,7 +483,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/ */
public function serialize() public function serialize()
{ {
$event = new Doctrine_Event($this, Doctrine_Event::RECORD_SERIALIZE); $event = new Doctrine_Event($this, Doctrine_Event::RECORD_SERIALIZE);
$this->preSerialize($event); $this->preSerialize($event);
@ -536,9 +536,9 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/ */
public function unserialize($serialized) public function unserialize($serialized)
{ {
$event = new Doctrine_Event($this, Doctrine_Event::RECORD_UNSERIALIZE); $event = new Doctrine_Event($this, Doctrine_Event::RECORD_UNSERIALIZE);
$this->preUnserialize($event); $this->preUnserialize($event);
$manager = Doctrine_Manager::getInstance(); $manager = Doctrine_Manager::getInstance();
$connection = $manager->getConnectionForComponent(get_class($this)); $connection = $manager->getConnectionForComponent(get_class($this));
@ -674,7 +674,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
{ {
if (is_null($name)) { if (is_null($name)) {
foreach ($this->_table->getRelations() as $rel) { foreach ($this->_table->getRelations() as $rel) {
$this->_references[$rel->getAlias()] = $rel->fetchRelatedFor($this); $this->_references[$rel->getAlias()] = $rel->fetchRelatedFor($this);
} }
} else { } else {
$rel = $this->_table->getRelation($name); $rel = $this->_table->getRelation($name);
@ -897,7 +897,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
} }
if ($rel instanceof Doctrine_Relation_LocalKey) { if ($rel instanceof Doctrine_Relation_LocalKey) {
$foreign = $rel->getForeign(); $foreign = $rel->getForeign();
if (!empty($foreign) && $foreign != $value->getTable()->getIdentifier()) if ( ! empty($foreign) && $foreign != $value->getTable()->getIdentifier())
$this->set($rel->getLocal(), $value->rawGet($foreign), false); $this->set($rel->getLocal(), $value->rawGet($foreign), false);
else else
$this->set($rel->getLocal(), $value, false); $this->set($rel->getLocal(), $value, false);
@ -933,7 +933,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
return true; return true;
} }
if (isset($this->_values[$lower])) { if (isset($this->_values[$lower])) {
return true; return true;
} }
if (isset($this->_references[$name]) && if (isset($this->_references[$name]) &&
$this->_references[$name] !== self::$_null) { $this->_references[$name] !== self::$_null) {
@ -1202,7 +1202,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/ */
public function copy() public function copy()
{ {
$data = $this->_data; $data = $this->_data;
if ($this->_table->getIdentifierType() === Doctrine::IDENTIFIER_AUTOINC) { if ($this->_table->getIdentifierType() === Doctrine::IDENTIFIER_AUTOINC) {
$id = $this->_table->getIdentifier(); $id = $this->_table->getIdentifier();
@ -1228,7 +1228,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
* *
* @return Doctrine_Record * @return Doctrine_Record
*/ */
public function copyDeep(){ public function copyDeep() {
$copy = $this->copy(); $copy = $this->copy();
foreach ($this->_references as $key => $value) { foreach ($this->_references as $key => $value) {

View File

@ -102,7 +102,7 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
public function setSubclasses($map) public function setSubclasses($map)
{ {
if (isset($map[get_class($this)])){ if (isset($map[get_class($this)])) {
$this->_table->setOption('inheritanceMap', $map[get_class($this)]); $this->_table->setOption('inheritanceMap', $map[get_class($this)]);
return; return;
} }
@ -246,8 +246,8 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
*/ */
public function loadTemplate($template, array $options = array()) public function loadTemplate($template, array $options = array())
{ {
$tpl = new $template($options); $tpl = new $template($options);
$tpl->setTable($this->_table); $tpl->setTable($this->_table);
$tpl->setUp(); $tpl->setUp();
@ -302,7 +302,7 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
*/ */
public function check($constraint, $name = null) public function check($constraint, $name = null)
{ {
if (is_array($constraint)) { if (is_array($constraint)) {
foreach ($constraint as $name => $def) { foreach ($constraint as $name => $def) {
$this->_table->addCheckConstraint($def, $name); $this->_table->addCheckConstraint($def, $name);
} }

View File

@ -64,7 +64,7 @@ class Doctrine_Record_Filter extends Doctrine_Object
*/ */
public function assignDefaultValues($data, $overwrite = false) public function assignDefaultValues($data, $overwrite = false)
{ {
$table = $this->_record->getTable(); $table = $this->_record->getTable();
if ( ! $table->hasDefaultValues()) { if ( ! $table->hasDefaultValues()) {
return false; return false;
@ -95,7 +95,7 @@ class Doctrine_Record_Filter extends Doctrine_Object
private function prepareIdentifiers($exists = true) private function prepareIdentifiers($exists = true)
{ {
$id = $this->_table->getIdentifier(); $id = $this->_table->getIdentifier();
$this->_id = array(); $this->_id = array();
if (count($id) > 1) { if (count($id) > 1) {
foreach ($id as $name) { foreach ($id as $name) {
if ($this->_data[$name] === self::$_null) { if ($this->_data[$name] === self::$_null) {
@ -104,7 +104,7 @@ class Doctrine_Record_Filter extends Doctrine_Object
$this->_id[$name] = $this->_data[$name]; $this->_id[$name] = $this->_data[$name];
} }
} }
} else { } else {
if (isset($this->_data[$id]) && $this->_data[$id] !== self::$_null) { if (isset($this->_data[$id]) && $this->_data[$id] !== self::$_null) {
$this->_id[$id] = $this->_data[$id]; $this->_id[$id] = $this->_data[$id];
} }

View File

@ -118,15 +118,15 @@ abstract class Doctrine_Relation implements ArrayAccess
*/ */
public function __construct(array $definition) public function __construct(array $definition)
{ {
$def = array(); $def = array();
foreach ($this->definition as $key => $val) { foreach ($this->definition as $key => $val) {
if ( ! isset($definition[$key]) && $val) { if ( ! isset($definition[$key]) && $val) {
throw new Doctrine_Exception($key . ' is required!'); throw new Doctrine_Exception($key . ' is required!');
} }
if (isset($definition[$key])) { if (isset($definition[$key])) {
$def[$key] = $definition[$key]; $def[$key] = $definition[$key];
} else { } else {
$def[$key] = null; $def[$key] = null;
} }
} }
@ -276,7 +276,7 @@ abstract class Doctrine_Relation implements ArrayAccess
*/ */
public function getRelationDql($count) public function getRelationDql($count)
{ {
$component = $this->getTable()->getComponentName(); $component = $this->getTable()->getComponentName();
$dql = 'FROM ' . $component $dql = 'FROM ' . $component
. ' WHERE ' . $component . '.' . $this->definition['foreign'] . ' WHERE ' . $component . '.' . $this->definition['foreign']
@ -302,7 +302,7 @@ abstract class Doctrine_Relation implements ArrayAccess
{ {
$r[] = "<pre>"; $r[] = "<pre>";
foreach ($this->definition as $k => $v) { foreach ($this->definition as $k => $v) {
if(is_object($v)) { if (is_object($v)) {
$v = 'Object(' . get_class($v) . ')'; $v = 'Object(' . get_class($v) . ')';
} }
$r[] = $k . ' : ' . $v; $r[] = $k . ' : ' . $v;

View File

@ -44,7 +44,7 @@ class Doctrine_Relation_Association extends Doctrine_Relation
} }
public function getAssociationTable() public function getAssociationTable()
{ {
return $this->definition['refTable']; return $this->definition['refTable'];
} }
/** /**
* getRelationDql * getRelationDql
@ -54,7 +54,7 @@ class Doctrine_Relation_Association extends Doctrine_Relation
*/ */
public function getRelationDql($count, $context = 'record') public function getRelationDql($count, $context = 'record')
{ {
$component = $this->definition['refTable']->getComponentName(); $component = $this->definition['refTable']->getComponentName();
switch ($context) { switch ($context) {
case "record": case "record":
$sub = substr(str_repeat("?, ", $count),0,-2); $sub = substr(str_repeat("?, ", $count),0,-2);

View File

@ -43,9 +43,9 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
*/ */
public function fetchRelatedFor(Doctrine_Record $record) public function fetchRelatedFor(Doctrine_Record $record)
{ {
$id = array(); $id = array();
foreach ((array) $this->definition['local'] as $local) { foreach ((array) $this->definition['local'] as $local) {
$value = $record->get($local); $value = $record->get($local);
if (isset($value)) { if (isset($value)) {
$id[] = $value; $id[] = $value;
} }
@ -86,10 +86,10 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
*/ */
public function getCondition($alias = null) public function getCondition($alias = null)
{ {
if ( ! $alias) { if ( ! $alias) {
$alias = $this->getTable()->getComponentName(); $alias = $this->getTable()->getComponentName();
} }
$conditions = array(); $conditions = array();
foreach ((array) $this->definition['foreign'] as $foreign) { foreach ((array) $this->definition['foreign'] as $foreign) {
$conditions[] = $alias . '.' . $foreign . ' = ?'; $conditions[] = $alias . '.' . $foreign . ' = ?';
} }

View File

@ -73,10 +73,10 @@ class Doctrine_Relation_LocalKey extends Doctrine_Relation
*/ */
public function getCondition($alias = null) public function getCondition($alias = null)
{ {
if ( ! $alias) { if ( ! $alias) {
$alias = $this->getTable()->getComponentName(); $alias = $this->getTable()->getComponentName();
} }
return $alias . '.' . $this->definition['foreign'] . ' = ?'; return $alias . '.' . $this->definition['foreign'] . ' = ?';
} }
} }

View File

@ -68,11 +68,11 @@ class Doctrine_Relation_Parser
*/ */
public function getPendingRelation($name) public function getPendingRelation($name)
{ {
if ( ! isset($this->_pending[$name])) { if ( ! isset($this->_pending[$name])) {
throw new Doctrine_Relation_Exception('Unknown pending relation ' . $name); throw new Doctrine_Relation_Exception('Unknown pending relation ' . $name);
} }
return $this->_pending[$name]; return $this->_pending[$name];
} }
public function hasRelation($name) public function hasRelation($name)
@ -218,7 +218,7 @@ class Doctrine_Relation_Parser
*/ */
public function getImpl($template) public function getImpl($template)
{ {
$conn = $this->_table->getConnection(); $conn = $this->_table->getConnection();
if (in_array('Doctrine_Template', class_parents($template))) { if (in_array('Doctrine_Template', class_parents($template))) {
$impl = $this->_table->getImpl($template); $impl = $this->_table->getImpl($template);
@ -240,7 +240,7 @@ class Doctrine_Relation_Parser
*/ */
public function completeAssocDefinition($def) public function completeAssocDefinition($def)
{ {
$conn = $this->_table->getConnection(); $conn = $this->_table->getConnection();
$def['table'] = $this->getImpl($def['class']); $def['table'] = $this->getImpl($def['class']);
$def['class'] = $def['table']->getComponentName(); $def['class'] = $def['table']->getComponentName();
$def['refTable'] = $this->getImpl($def['refClass']); $def['refTable'] = $this->getImpl($def['refClass']);
@ -291,16 +291,16 @@ class Doctrine_Relation_Parser
*/ */
public function getIdentifiers(Doctrine_Table $table) public function getIdentifiers(Doctrine_Table $table)
{ {
if (is_array($table->getIdentifier())) { if (is_array($table->getIdentifier())) {
$columns = array(); $columns = array();
foreach((array) $table->getIdentifier() as $identifier) { foreach((array) $table->getIdentifier() as $identifier) {
$columns[] = strtolower($table->getComponentName()) $columns[] = strtolower($table->getComponentName())
. '_' . $table->getIdentifier(); . '_' . $table->getIdentifier();
} }
} else { } else {
$columns = strtolower($table->getComponentName()) $columns = strtolower($table->getComponentName())
. '_' . $table->getIdentifier(); . '_' . $table->getIdentifier();
} }
return $columns; return $columns;
} }
@ -349,7 +349,7 @@ class Doctrine_Relation_Parser
*/ */
public function completeDefinition($def) public function completeDefinition($def)
{ {
$conn = $this->_table->getConnection(); $conn = $this->_table->getConnection();
$def['table'] = $this->getImpl($def['class']); $def['table'] = $this->getImpl($def['class']);
$def['class'] = $def['table']->getComponentName(); $def['class'] = $def['table']->getComponentName();

View File

@ -60,7 +60,7 @@ class Doctrine_Schema extends Doctrine_Schema_Object implements Countable, Itera
* @return array of Doctrine_Schema_Database * @return array of Doctrine_Schema_Database
* *
*/ */
public function getDatabases(){ public function getDatabases() {
return $this->childs; return $this->childs;
} }
/** /**

View File

@ -96,7 +96,7 @@ class Doctrine_Schema_Table extends Doctrine_Schema_Object implements Countable,
* @param Doctrine_Schema_Relation Relation * @param Doctrine_Schema_Relation Relation
* *
*/ */
public function setRelation(Doctrine_Schema_Relation $relation){ public function setRelation(Doctrine_Schema_Relation $relation) {
$this->relations[] = $relation; $this->relations[] = $relation;
} }
/** /**
@ -104,7 +104,7 @@ class Doctrine_Schema_Table extends Doctrine_Schema_Object implements Countable,
* *
* @return array Array of Doctrine_Schema_Relation * @return array Array of Doctrine_Schema_Relation
*/ */
public function getRelations(){ public function getRelations() {
return $this->relations; return $this->relations;
} }

View File

@ -74,7 +74,7 @@ class Doctrine_Search
*/ */
public function updateIndex(Doctrine_Record $record) public function updateIndex(Doctrine_Record $record)
{ {
$fields = $this->getOption('fields'); $fields = $this->getOption('fields');
$class = $this->getOption('className'); $class = $this->getOption('className');
$name = $record->getTable()->getComponentName(); $name = $record->getTable()->getComponentName();

View File

@ -266,7 +266,7 @@ class Doctrine_Search_Analyzer_Standard implements Doctrine_Search_Analyzer_Inte
public function analyze($text) public function analyze($text)
{ {
$text = preg_replace('/[.()&#!,?^£@%&{}+]/', ' ', $text); $text = preg_replace('/[.()&#!,?^£@%&{}+]/', ' ', $text);
$text = str_replace(' ', ' ', $text); $text = str_replace(' ', ' ', $text);
$terms = explode(' ', $text); $terms = explode(' ', $text);

View File

@ -34,9 +34,9 @@ class Doctrine_Search_Indexer
{ {
public function indexDirectory($dir) public function indexDirectory($dir)
{ {
if ( ! file_exists($dir)) { if ( ! file_exists($dir)) {
throw new Doctrine_Search_Indexer_Exception('Unknown directory ' . $dir); throw new Doctrine_Search_Indexer_Exception('Unknown directory ' . $dir);
} }
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY); $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY);

View File

@ -34,9 +34,9 @@ class Doctrine_Search_Indexer_Dir
{ {
public function add($dir) public function add($dir)
{ {
if ( ! file_exists($dir)) { if ( ! file_exists($dir)) {
throw new Doctrine_Search_Indexer_Exception('Unknown directory ' . $dir); throw new Doctrine_Search_Indexer_Exception('Unknown directory ' . $dir);
} }
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY); $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY);

View File

@ -183,7 +183,7 @@ class Doctrine_Search_Query
public function parseTerm($term) public function parseTerm($term)
{ {
$negation = false; $negation = false;
if (strpos($term, "'") === false) { if (strpos($term, "'") === false) {
$where = $this->parseWord($term); $where = $this->parseWord($term);

View File

@ -345,7 +345,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
} }
$columns[$name] = $definition; $columns[$name] = $definition;
if(isset($definition['primary']) && $definition['primary']) { if (isset($definition['primary']) && $definition['primary']) {
$primary[] = $name; $primary[] = $name;
} }
} }
@ -487,7 +487,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
*/ */
public function addCheckConstraint($definition, $name) public function addCheckConstraint($definition, $name)
{ {
if (is_string($name)) { if (is_string($name)) {
$this->options['checks'][$name] = $definition; $this->options['checks'][$name] = $definition;
} else { } else {
$this->options['checks'][] = $definition; $this->options['checks'][] = $definition;
@ -521,7 +521,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
} }
public function bind($args, $type) public function bind($args, $type)
{ {
$options = array(); $options = array();
$options['type'] = $type; $options['type'] = $type;
if ( ! isset($args[1])) { if ( ! isset($args[1])) {
@ -668,7 +668,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
public function getColumnName($alias) public function getColumnName($alias)
{ {
$alias = strtolower($alias); $alias = strtolower($alias);
if(isset($this->columnAliases[$alias])) { if (isset($this->columnAliases[$alias])) {
return $this->columnAliases[$alias]; return $this->columnAliases[$alias];
} }
@ -883,7 +883,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
return $records->getFirst(); return $records->getFirst();
} }
case Doctrine::FETCH_ARRAY: case Doctrine::FETCH_ARRAY:
if (!empty($records[0])) { if ( ! empty($records[0])) {
return $records[0]; return $records[0];
} }
} }
@ -977,7 +977,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
*/ */
public function getRecord() public function getRecord()
{ {
if ( ! empty($this->data)) { if ( ! empty($this->data)) {
$this->data = array_change_key_case($this->data, CASE_LOWER); $this->data = array_change_key_case($this->data, CASE_LOWER);
$key = $this->getIdentifier(); $key = $this->getIdentifier();
@ -1041,7 +1041,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
*/ */
public function getClassnameToReturn() public function getClassnameToReturn()
{ {
if (!isset($this->options['subclasses'])) { if ( ! isset($this->options['subclasses'])) {
return $this->options['name']; return $this->options['name'];
} }
foreach ($this->options['subclasses'] as $subclass) { foreach ($this->options['subclasses'] as $subclass) {
@ -1126,7 +1126,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
return $index; return $index;
} }
if (!$this->conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM) if ( ! $this->conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)
&& isset($this->columns[$field]['values'][$index]) && isset($this->columns[$field]['values'][$index])
) { ) {
return $this->columns[$field]['values'][$index]; return $this->columns[$field]['values'][$index];
@ -1330,11 +1330,11 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
public function getTemplate($template) public function getTemplate($template)
{ {
if ( ! isset($this->_templates[$template])) { if ( ! isset($this->_templates[$template])) {
throw new Doctrine_Table_Exception('Template ' . $template . ' not loaded'); throw new Doctrine_Table_Exception('Template ' . $template . ' not loaded');
} }
return $this->_templates[$template]; return $this->_templates[$template];
} }
public function addTemplate($template, Doctrine_Template $impl) public function addTemplate($template, Doctrine_Template $impl)

View File

@ -39,7 +39,7 @@ class Doctrine_Template_Versionable extends Doctrine_Template
} }
public function setUp() public function setUp()
{ {
$this->_auditLog->setOption('table', $this->_table); $this->_auditLog->setOption('table', $this->_table);
$this->_auditLog->buildDefinition($this->_table); $this->_auditLog->buildDefinition($this->_table);
$this->addListener(new Doctrine_AuditLog_Listener($this->_auditLog)); $this->addListener(new Doctrine_AuditLog_Listener($this->_auditLog));

View File

@ -78,7 +78,7 @@ class Doctrine_Tokenizer
*/ */
public static function bracketExplode($str, $d = ' ', $e1 = '(', $e2 = ')') public static function bracketExplode($str, $d = ' ', $e1 = '(', $e2 = ')')
{ {
if(is_array($d)) { if (is_array($d)) {
$a = preg_split('/('.implode('|', $d).')/', $str); $a = preg_split('/('.implode('|', $d).')/', $str);
$d = stripslashes($d[0]); $d = stripslashes($d[0]);
} else { } else {
@ -93,7 +93,7 @@ class Doctrine_Tokenizer
$s1 = substr_count($term[$i], $e1); $s1 = substr_count($term[$i], $e1);
$s2 = substr_count($term[$i], $e2); $s2 = substr_count($term[$i], $e2);
if($s1 == $s2) { if ($s1 == $s2) {
$i++; $i++;
} }
} else { } else {
@ -101,7 +101,7 @@ class Doctrine_Tokenizer
$c1 = substr_count($term[$i], $e1); $c1 = substr_count($term[$i], $e1);
$c2 = substr_count($term[$i], $e2); $c2 = substr_count($term[$i], $e2);
if($c1 == $c2) { if ($c1 == $c2) {
$i++; $i++;
} }
} }
@ -210,7 +210,7 @@ class Doctrine_Tokenizer
$s2 = substr_count($term[$i], $e2); $s2 = substr_count($term[$i], $e2);
if (strpos($term[$i], '(') !== false) { if (strpos($term[$i], '(') !== false) {
if($s1 == $s2) { if ($s1 == $s2) {
$i++; $i++;
} }
} else { } else {
@ -225,7 +225,7 @@ class Doctrine_Tokenizer
$c2 = substr_count($term[$i], $e2); $c2 = substr_count($term[$i], $e2);
if (strpos($term[$i], '(') !== false) { if (strpos($term[$i], '(') !== false) {
if($c1 == $c2) { if ($c1 == $c2) {
$i++; $i++;
} }
} else { } else {
@ -300,7 +300,7 @@ class Doctrine_Tokenizer
$c2 = substr_count($term[$i], $e2); $c2 = substr_count($term[$i], $e2);
if (strpos($term[$i], '(') !== false) { if (strpos($term[$i], '(') !== false) {
if($c1 == $c2) { if ($c1 == $c2) {
$i++; $i++;
} }
} else { } else {

View File

@ -207,7 +207,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
*/ */
public function commit($savepoint = null) public function commit($savepoint = null)
{ {
$this->conn->connect(); $this->conn->connect();
if ($this->transactionLevel == 0) { if ($this->transactionLevel == 0) {
return false; return false;
@ -363,7 +363,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
*/ */
private function removeSavePoints($savepoint) private function removeSavePoints($savepoint)
{ {
$this->savePoints = array_values($this->savePoints); $this->savePoints = array_values($this->savePoints);
$found = false; $found = false;
$i = 0; $i = 0;

View File

@ -95,7 +95,7 @@ class Doctrine_Tree
public static function factory(Doctrine_Table $table, $implName, $options = array()) public static function factory(Doctrine_Table $table, $implName, $options = array())
{ {
$class = 'Doctrine_Tree_' . $implName; $class = 'Doctrine_Tree_' . $implName;
if (!class_exists($class)) { if ( ! class_exists($class)) {
throw new Doctrine_Exception('The chosen class must extend Doctrine_Tree'); throw new Doctrine_Exception('The chosen class must extend Doctrine_Tree');
} }
return new $class($table, $options); return new $class($table, $options);

View File

@ -44,7 +44,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
{ {
// set default many root attributes // set default many root attributes
$options['hasManyRoots'] = isset($options['hasManyRoots']) ? $options['hasManyRoots'] : false; $options['hasManyRoots'] = isset($options['hasManyRoots']) ? $options['hasManyRoots'] : false;
if($options['hasManyRoots']) if ($options['hasManyRoots'])
$options['rootColumnName'] = isset($options['rootColumnName']) ? $options['rootColumnName'] : 'root_id'; $options['rootColumnName'] = isset($options['rootColumnName']) ? $options['rootColumnName'] : 'root_id';
parent::__construct($table, $options); parent::__construct($table, $options);
@ -266,7 +266,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
*/ */
public function getBaseQuery() public function getBaseQuery()
{ {
if (!isset($this->_baseQuery)) { if ( ! isset($this->_baseQuery)) {
$this->_baseQuery = $this->_createBaseQuery(); $this->_baseQuery = $this->_createBaseQuery();
} }
return $this->_baseQuery->copy(); return $this->_baseQuery->copy();

View File

@ -93,7 +93,7 @@ class Doctrine_Validator extends Doctrine_Object
} }
if ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS) { if ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS) {
if (!$this->validateLength($column, $key, $value)) { if ( ! $this->validateLength($column, $key, $value)) {
$errorStack->add($key, 'length'); $errorStack->add($key, 'length');
continue; continue;
@ -119,7 +119,7 @@ class Doctrine_Validator extends Doctrine_Object
if (strtolower($name) == 'length') { if (strtolower($name) == 'length') {
if ( ! ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS)) { if ( ! ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS)) {
if (!$this->validateLength($column, $key, $value)) { if ( ! $this->validateLength($column, $key, $value)) {
$errorStack->add($key, 'length'); $errorStack->add($key, 'length');
} }
} }

View File

@ -33,249 +33,249 @@
class Doctrine_Validator_Country class Doctrine_Validator_Country
{ {
private static $countries = array( private static $countries = array(
'ad' => 'Andorra', 'ad' => 'Andorra',
'ae' => 'United Arab Emirates', 'ae' => 'United Arab Emirates',
'af' => 'Afghanistan', 'af' => 'Afghanistan',
'ag' => 'Antigua and Barbuda', 'ag' => 'Antigua and Barbuda',
'ai' => 'Anguilla', 'ai' => 'Anguilla',
'al' => 'Albania', 'al' => 'Albania',
'am' => 'Armenia', 'am' => 'Armenia',
'an' => 'Netherlands Antilles', 'an' => 'Netherlands Antilles',
'ao' => 'Angola', 'ao' => 'Angola',
'aq' => 'Antarctica', 'aq' => 'Antarctica',
'ar' => 'Argentina', 'ar' => 'Argentina',
'as' => 'American Samoa', 'as' => 'American Samoa',
'at' => 'Austria', 'at' => 'Austria',
'au' => 'Australia', 'au' => 'Australia',
'aw' => 'Aruba', 'aw' => 'Aruba',
'az' => 'Azerbaijan', 'az' => 'Azerbaijan',
'ba' => 'Bosnia Hercegovina', 'ba' => 'Bosnia Hercegovina',
'bb' => 'Barbados', 'bb' => 'Barbados',
'bd' => 'Bangladesh', 'bd' => 'Bangladesh',
'be' => 'Belgium', 'be' => 'Belgium',
'bf' => 'Burkina Faso', 'bf' => 'Burkina Faso',
'bg' => 'Bulgaria', 'bg' => 'Bulgaria',
'bh' => 'Bahrain', 'bh' => 'Bahrain',
'bi' => 'Burundi', 'bi' => 'Burundi',
'bj' => 'Benin', 'bj' => 'Benin',
'bm' => 'Bermuda', 'bm' => 'Bermuda',
'bn' => 'Brunei Darussalam', 'bn' => 'Brunei Darussalam',
'bo' => 'Bolivia', 'bo' => 'Bolivia',
'br' => 'Brazil', 'br' => 'Brazil',
'bs' => 'Bahamas', 'bs' => 'Bahamas',
'bt' => 'Bhutan', 'bt' => 'Bhutan',
'bv' => 'Bouvet Island', 'bv' => 'Bouvet Island',
'bw' => 'Botswana', 'bw' => 'Botswana',
'by' => 'Belarus (Byelorussia)', 'by' => 'Belarus (Byelorussia)',
'bz' => 'Belize', 'bz' => 'Belize',
'ca' => 'Canada', 'ca' => 'Canada',
'cc' => 'Cocos Islands', 'cc' => 'Cocos Islands',
'cd' => 'Congo, The Democratic Republic of the', 'cd' => 'Congo, The Democratic Republic of the',
'cf' => 'Central African Republic', 'cf' => 'Central African Republic',
'cg' => 'Congo', 'cg' => 'Congo',
'ch' => 'Switzerland', 'ch' => 'Switzerland',
'ci' => 'Ivory Coast', 'ci' => 'Ivory Coast',
'ck' => 'Cook Islands', 'ck' => 'Cook Islands',
'cl' => 'Chile', 'cl' => 'Chile',
'cm' => 'Cameroon', 'cm' => 'Cameroon',
'cn' => 'China', 'cn' => 'China',
'co' => 'Colombia', 'co' => 'Colombia',
'cr' => 'Costa Rica', 'cr' => 'Costa Rica',
'cs' => 'Czechoslovakia', 'cs' => 'Czechoslovakia',
'cu' => 'Cuba', 'cu' => 'Cuba',
'cv' => 'Cape Verde', 'cv' => 'Cape Verde',
'cx' => 'Christmas Island', 'cx' => 'Christmas Island',
'cy' => 'Cyprus', 'cy' => 'Cyprus',
'cz' => 'Czech Republic', 'cz' => 'Czech Republic',
'de' => 'Germany', 'de' => 'Germany',
'dj' => 'Djibouti', 'dj' => 'Djibouti',
'dk' => 'Denmark', 'dk' => 'Denmark',
'dm' => 'Dominica', 'dm' => 'Dominica',
'do' => 'Dominican Republic', 'do' => 'Dominican Republic',
'dz' => 'Algeria', 'dz' => 'Algeria',
'ec' => 'Ecuador', 'ec' => 'Ecuador',
'ee' => 'Estonia', 'ee' => 'Estonia',
'eg' => 'Egypt', 'eg' => 'Egypt',
'eh' => 'Western Sahara', 'eh' => 'Western Sahara',
'er' => 'Eritrea', 'er' => 'Eritrea',
'es' => 'Spain', 'es' => 'Spain',
'et' => 'Ethiopia', 'et' => 'Ethiopia',
'fi' => 'Finland', 'fi' => 'Finland',
'fj' => 'Fiji', 'fj' => 'Fiji',
'fk' => 'Falkland Islands', 'fk' => 'Falkland Islands',
'fm' => 'Micronesia', 'fm' => 'Micronesia',
'fo' => 'Faroe Islands', 'fo' => 'Faroe Islands',
'fr' => 'France', 'fr' => 'France',
'fx' => 'France, Metropolitan FX', 'fx' => 'France, Metropolitan FX',
'ga' => 'Gabon', 'ga' => 'Gabon',
'gb' => 'United Kingdom (Great Britain)', 'gb' => 'United Kingdom (Great Britain)',
'gd' => 'Grenada', 'gd' => 'Grenada',
'ge' => 'Georgia', 'ge' => 'Georgia',
'gf' => 'French Guiana', 'gf' => 'French Guiana',
'gh' => 'Ghana', 'gh' => 'Ghana',
'gi' => 'Gibraltar', 'gi' => 'Gibraltar',
'gl' => 'Greenland', 'gl' => 'Greenland',
'gm' => 'Gambia', 'gm' => 'Gambia',
'gn' => 'Guinea', 'gn' => 'Guinea',
'gp' => 'Guadeloupe', 'gp' => 'Guadeloupe',
'gq' => 'Equatorial Guinea', 'gq' => 'Equatorial Guinea',
'gr' => 'Greece', 'gr' => 'Greece',
'gs' => 'South Georgia and the South Sandwich Islands', 'gs' => 'South Georgia and the South Sandwich Islands',
'gt' => 'Guatemala', 'gt' => 'Guatemala',
'gu' => 'Guam', 'gu' => 'Guam',
'gw' => 'Guinea-bissau', 'gw' => 'Guinea-bissau',
'gy' => 'Guyana', 'gy' => 'Guyana',
'hk' => 'Hong Kong', 'hk' => 'Hong Kong',
'hm' => 'Heard and McDonald Islands', 'hm' => 'Heard and McDonald Islands',
'hn' => 'Honduras', 'hn' => 'Honduras',
'hr' => 'Croatia', 'hr' => 'Croatia',
'ht' => 'Haiti', 'ht' => 'Haiti',
'hu' => 'Hungary', 'hu' => 'Hungary',
'id' => 'Indonesia', 'id' => 'Indonesia',
'ie' => 'Ireland', 'ie' => 'Ireland',
'il' => 'Israel', 'il' => 'Israel',
'in' => 'India', 'in' => 'India',
'io' => 'British Indian Ocean Territory', 'io' => 'British Indian Ocean Territory',
'iq' => 'Iraq', 'iq' => 'Iraq',
'ir' => 'Iran', 'ir' => 'Iran',
'is' => 'Iceland', 'is' => 'Iceland',
'it' => 'Italy', 'it' => 'Italy',
'jm' => 'Jamaica', 'jm' => 'Jamaica',
'jo' => 'Jordan', 'jo' => 'Jordan',
'jp' => 'Japan', 'jp' => 'Japan',
'ke' => 'Kenya', 'ke' => 'Kenya',
'kg' => 'Kyrgyzstan', 'kg' => 'Kyrgyzstan',
'kh' => 'Cambodia', 'kh' => 'Cambodia',
'ki' => 'Kiribati', 'ki' => 'Kiribati',
'km' => 'Comoros', 'km' => 'Comoros',
'kn' => 'Saint Kitts and Nevis', 'kn' => 'Saint Kitts and Nevis',
'kp' => 'North Korea', 'kp' => 'North Korea',
'kr' => 'South Korea', 'kr' => 'South Korea',
'kw' => 'Kuwait', 'kw' => 'Kuwait',
'ky' => 'Cayman Islands', 'ky' => 'Cayman Islands',
'kz' => 'Kazakhstan', 'kz' => 'Kazakhstan',
'la' => 'Laos', 'la' => 'Laos',
'lb' => 'Lebanon', 'lb' => 'Lebanon',
'lc' => 'Saint Lucia', 'lc' => 'Saint Lucia',
'li' => 'Lichtenstein', 'li' => 'Lichtenstein',
'lk' => 'Sri Lanka', 'lk' => 'Sri Lanka',
'lr' => 'Liberia', 'lr' => 'Liberia',
'ls' => 'Lesotho', 'ls' => 'Lesotho',
'lt' => 'Lithuania', 'lt' => 'Lithuania',
'lu' => 'Luxembourg', 'lu' => 'Luxembourg',
'lv' => 'Latvia', 'lv' => 'Latvia',
'ly' => 'Libya', 'ly' => 'Libya',
'ma' => 'Morocco', 'ma' => 'Morocco',
'mc' => 'Monaco', 'mc' => 'Monaco',
'md' => 'Moldova Republic', 'md' => 'Moldova Republic',
'mg' => 'Madagascar', 'mg' => 'Madagascar',
'mh' => 'Marshall Islands', 'mh' => 'Marshall Islands',
'mk' => 'Macedonia, The Former Yugoslav Republic of', 'mk' => 'Macedonia, The Former Yugoslav Republic of',
'ml' => 'Mali', 'ml' => 'Mali',
'mm' => 'Myanmar', 'mm' => 'Myanmar',
'mn' => 'Mongolia', 'mn' => 'Mongolia',
'mo' => 'Macau', 'mo' => 'Macau',
'mp' => 'Northern Mariana Islands', 'mp' => 'Northern Mariana Islands',
'mq' => 'Martinique', 'mq' => 'Martinique',
'mr' => 'Mauritania', 'mr' => 'Mauritania',
'ms' => 'Montserrat', 'ms' => 'Montserrat',
'mt' => 'Malta', 'mt' => 'Malta',
'mu' => 'Mauritius', 'mu' => 'Mauritius',
'mv' => 'Maldives', 'mv' => 'Maldives',
'mw' => 'Malawi', 'mw' => 'Malawi',
'mx' => 'Mexico', 'mx' => 'Mexico',
'my' => 'Malaysia', 'my' => 'Malaysia',
'mz' => 'Mozambique', 'mz' => 'Mozambique',
'na' => 'Namibia', 'na' => 'Namibia',
'nc' => 'New Caledonia', 'nc' => 'New Caledonia',
'ne' => 'Niger', 'ne' => 'Niger',
'nf' => 'Norfolk Island', 'nf' => 'Norfolk Island',
'ng' => 'Nigeria', 'ng' => 'Nigeria',
'ni' => 'Nicaragua', 'ni' => 'Nicaragua',
'nl' => 'Netherlands', 'nl' => 'Netherlands',
'no' => 'Norway', 'no' => 'Norway',
'np' => 'Nepal', 'np' => 'Nepal',
'nr' => 'Nauru', 'nr' => 'Nauru',
'nt' => 'Neutral Zone', 'nt' => 'Neutral Zone',
'nu' => 'Niue', 'nu' => 'Niue',
'nz' => 'New Zealand', 'nz' => 'New Zealand',
'om' => 'Oman', 'om' => 'Oman',
'pa' => 'Panama', 'pa' => 'Panama',
'pe' => 'Peru', 'pe' => 'Peru',
'pf' => 'French Polynesia', 'pf' => 'French Polynesia',
'pg' => 'Papua New Guinea', 'pg' => 'Papua New Guinea',
'ph' => 'Philippines', 'ph' => 'Philippines',
'pk' => 'Pakistan', 'pk' => 'Pakistan',
'pl' => 'Poland', 'pl' => 'Poland',
'pm' => 'St. Pierre and Miquelon', 'pm' => 'St. Pierre and Miquelon',
'pn' => 'Pitcairn', 'pn' => 'Pitcairn',
'pr' => 'Puerto Rico', 'pr' => 'Puerto Rico',
'pt' => 'Portugal', 'pt' => 'Portugal',
'pw' => 'Palau', 'pw' => 'Palau',
'py' => 'Paraguay', 'py' => 'Paraguay',
'qa' => 'Qatar', 'qa' => 'Qatar',
're' => 'Reunion', 're' => 'Reunion',
'ro' => 'Romania', 'ro' => 'Romania',
'ru' => 'Russia', 'ru' => 'Russia',
'rw' => 'Rwanda', 'rw' => 'Rwanda',
'sa' => 'Saudi Arabia', 'sa' => 'Saudi Arabia',
'sb' => 'Solomon Islands', 'sb' => 'Solomon Islands',
'sc' => 'Seychelles', 'sc' => 'Seychelles',
'sd' => 'Sudan', 'sd' => 'Sudan',
'se' => 'Sweden', 'se' => 'Sweden',
'sg' => 'Singapore', 'sg' => 'Singapore',
'sh' => 'St. Helena', 'sh' => 'St. Helena',
'si' => 'Slovenia', 'si' => 'Slovenia',
'sj' => 'Svalbard and Jan Mayen Islands', 'sj' => 'Svalbard and Jan Mayen Islands',
'sk' => 'Slovakia (Slovak Republic)', 'sk' => 'Slovakia (Slovak Republic)',
'sl' => 'Sierra Leone', 'sl' => 'Sierra Leone',
'sm' => 'San Marino', 'sm' => 'San Marino',
'sn' => 'Senegal', 'sn' => 'Senegal',
'so' => 'Somalia', 'so' => 'Somalia',
'sr' => 'Suriname', 'sr' => 'Suriname',
'st' => 'Sao Tome and Principe', 'st' => 'Sao Tome and Principe',
'sv' => 'El Salvador', 'sv' => 'El Salvador',
'sy' => 'Syria', 'sy' => 'Syria',
'sz' => 'Swaziland', 'sz' => 'Swaziland',
'tc' => 'Turks and Caicos Islands', 'tc' => 'Turks and Caicos Islands',
'td' => 'Chad', 'td' => 'Chad',
'tf' => 'French Southern Territories', 'tf' => 'French Southern Territories',
'tg' => 'Togo', 'tg' => 'Togo',
'th' => 'Thailand', 'th' => 'Thailand',
'tj' => 'Tajikistan', 'tj' => 'Tajikistan',
'tk' => 'Tokelau', 'tk' => 'Tokelau',
'tm' => 'Turkmenistan', 'tm' => 'Turkmenistan',
'tn' => 'Tunisia', 'tn' => 'Tunisia',
'to' => 'Tonga', 'to' => 'Tonga',
'tp' => 'East Timor', 'tp' => 'East Timor',
'tr' => 'Turkey', 'tr' => 'Turkey',
'tt' => 'Trinidad, Tobago', 'tt' => 'Trinidad, Tobago',
'tv' => 'Tuvalu', 'tv' => 'Tuvalu',
'tw' => 'Taiwan', 'tw' => 'Taiwan',
'tz' => 'Tanzania', 'tz' => 'Tanzania',
'ua' => 'Ukraine', 'ua' => 'Ukraine',
'ug' => 'Uganda', 'ug' => 'Uganda',
'uk' => 'United Kingdom', 'uk' => 'United Kingdom',
'um' => 'United States Minor Islands', 'um' => 'United States Minor Islands',
'us' => 'United States of America', 'us' => 'United States of America',
'uy' => 'Uruguay', 'uy' => 'Uruguay',
'uz' => 'Uzbekistan', 'uz' => 'Uzbekistan',
'va' => 'Vatican City', 'va' => 'Vatican City',
'vc' => 'Saint Vincent, Grenadines', 'vc' => 'Saint Vincent, Grenadines',
've' => 'Venezuela', 've' => 'Venezuela',
'vg' => 'Virgin Islands (British)', 'vg' => 'Virgin Islands (British)',
'vi' => 'Virgin Islands (USA)', 'vi' => 'Virgin Islands (USA)',
'vn' => 'Viet Nam', 'vn' => 'Viet Nam',
'vu' => 'Vanuatu', 'vu' => 'Vanuatu',
'wf' => 'Wallis and Futuna Islands', 'wf' => 'Wallis and Futuna Islands',
'ws' => 'Samoa', 'ws' => 'Samoa',
'ye' => 'Yemen', 'ye' => 'Yemen',
'yt' => 'Mayotte', 'yt' => 'Mayotte',
'yu' => 'Yugoslavia', 'yu' => 'Yugoslavia',
'za' => 'South Africa', 'za' => 'South Africa',
'zm' => 'Zambia', 'zm' => 'Zambia',
'zr' => 'Zaire', 'zr' => 'Zaire',
'zw' => 'Zimbabwe'); 'zw' => 'Zimbabwe');
/** /**
* returns all available country codes * returns all available country codes
* *

View File

@ -73,7 +73,7 @@ class Doctrine_Validator_Exception extends Doctrine_Exception implements Countab
private function generateMessage() private function generateMessage()
{ {
$message = ""; $message = "";
foreach ($this->invalid as $record){ foreach ($this->invalid as $record) {
$message .= "Validaton error in class " . get_class($record) . " "; $message .= "Validaton error in class " . get_class($record) . " ";
} }
return $message; return $message;

View File

@ -41,9 +41,9 @@ class Doctrine_Validator_Regexp
*/ */
public function validate($value) public function validate($value)
{ {
if ( ! isset($this->args)) { if ( ! isset($this->args)) {
return true; return true;
} }
if (is_array($this->args)) { if (is_array($this->args)) {
foreach ($this->args as $regexp) { foreach ($this->args as $regexp) {
if ( ! preg_match($regexp, $value)) { if ( ! preg_match($regexp, $value)) {

View File

@ -56,7 +56,7 @@ class Doctrine_Validator_Unique
// unique value already exists in the database IF the record in the database is the same // unique value already exists in the database IF the record in the database is the same
// as the one that is validated here. // as the one that is validated here.
$state = $this->invoker->state(); $state = $this->invoker->state();
if (! ($state == Doctrine_Record::STATE_TDIRTY || $state == Doctrine_Record::STATE_TCLEAN)) { if ( ! ($state == Doctrine_Record::STATE_TDIRTY || $state == Doctrine_Record::STATE_TCLEAN)) {
foreach ($table->getPrimaryKeys() as $pk) { foreach ($table->getPrimaryKeys() as $pk) {
$sql .= " AND {$pk} != ?"; $sql .= " AND {$pk} != ?";
$values[] = $this->invoker->$pk; $values[] = $this->invoker->$pk;

View File

@ -33,7 +33,7 @@
class Doctrine_Validator_Usstate class Doctrine_Validator_Usstate
{ {
private static $states = array ( private static $states = array (
'AK' => true, 'AK' => true,
'AL' => true, 'AL' => true,
'AR' => true, 'AR' => true,
'AZ' => true, 'AZ' => true,
@ -84,8 +84,8 @@ class Doctrine_Validator_Usstate
'VT' => true, 'VT' => true,
'WA' => true, 'WA' => true,
'WI' => true, 'WI' => true,
'WV' => true, 'WV' => true,
'WY' => true 'WY' => true
); );
public function getStates() public function getStates()
{ {

View File

@ -38,8 +38,8 @@ class Doctrine_AuditLog_TestCase extends Doctrine_UnitTestCase
public function prepareTables() public function prepareTables()
{ {
$this->profiler = new Doctrine_Connection_Profiler(); $this->profiler = new Doctrine_Connection_Profiler();
$this->conn->addListener($this->profiler); $this->conn->addListener($this->profiler);
$this->tables = array('VersioningTest', 'VersioningTestVersion'); $this->tables = array('VersioningTest', 'VersioningTestVersion');
parent::prepareTables(); parent::prepareTables();

View File

@ -49,11 +49,11 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
*/ */
public function testAdapterQueryChecksCache() public function testAdapterQueryChecksCache()
{ {
$query = 'SELECT * FROM user'; $query = 'SELECT * FROM user';
$resultSet = array(array('name' => 'John'), array('name' => 'Arnold')); $resultSet = array(array('name' => 'John'), array('name' => 'Arnold'));
$this->cache->getDriver()->save(md5(serialize($query)), $resultSet); $this->cache->getDriver()->save(md5(serialize($query)), $resultSet);
$count = $this->dbh->getAdapter()->count(); $count = $this->dbh->getAdapter()->count();
@ -65,11 +65,11 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
} }
public function testAdapterStatementExecuteChecksCache() public function testAdapterStatementExecuteChecksCache()
{ {
$query = 'SELECT * FROM user WHERE id = ?'; $query = 'SELECT * FROM user WHERE id = ?';
$params = array(1); $params = array(1);
$resultSet = array(array('name' => 'John'), array('name' => 'Arnold')); $resultSet = array(array('name' => 'John'), array('name' => 'Arnold'));
$this->cache->getDriver()->save(md5(serialize(array($query, $params))), $resultSet); $this->cache->getDriver()->save(md5(serialize(array($query, $params))), $resultSet);
$count = $this->dbh->getAdapter()->count(); $count = $this->dbh->getAdapter()->count();
@ -115,13 +115,13 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
} }
public function testAdapterStatementExecuteAddsQueriesToCache() public function testAdapterStatementExecuteAddsQueriesToCache()
{ {
$this->cache->setOption('savePropability', 1); $this->cache->setOption('savePropability', 1);
$driver = $this->cache->getDriver(); $driver = $this->cache->getDriver();
$driver->deleteAll(); $driver->deleteAll();
$this->assertEqual($driver->count(), 0); $this->assertEqual($driver->count(), 0);
$stmt = $this->dbh->prepare('SELECT * FROM user WHERE id = ?'); $stmt = $this->dbh->prepare('SELECT * FROM user WHERE id = ?');
@ -131,9 +131,9 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
} }
public function testAppendStatsWritesQueriesToStatsFile() public function testAppendStatsWritesQueriesToStatsFile()
{ {
$this->cache->setOption('addStatsPropability', 1); $this->cache->setOption('addStatsPropability', 1);
$data = array(1,2,3); $data = array(1,2,3);
$this->cache->add('SELECT * FROM user'); $this->cache->add('SELECT * FROM user');
$this->cache->add(array('SELECT * FROM user WHERE id = ?', array(1))); $this->cache->add(array('SELECT * FROM user WHERE id = ?', array(1)));
@ -147,7 +147,7 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
} }
public function testCleanRemovesDriver() public function testCleanRemovesDriver()
{ {
$this->cache->setOption('cleanPropability', 1); $this->cache->setOption('cleanPropability', 1);
$this->cache->add('SELECT * FROM user'); $this->cache->add('SELECT * FROM user');
$this->cache->add(array('SELECT * FROM user WHERE id = ?', array(1))); $this->cache->add(array('SELECT * FROM user WHERE id = ?', array(1)));
@ -164,7 +164,7 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
{ {
parent::setUp(); parent::setUp();
if ( ! isset($this->cache)) { if ( ! isset($this->cache)) {
$this->cache = new Doctrine_Cache('Array'); $this->cache = new Doctrine_Cache('Array');
$this->cache->setOption('cacheFile', false); $this->cache->setOption('cacheFile', false);
$this->cache->setOption('savePropability', 0); $this->cache->setOption('savePropability', 0);

View File

@ -40,9 +40,9 @@ class Doctrine_Collection_Snapshot_TestCase extends Doctrine_UnitTestCase
{ {
public function prepareTables() public function prepareTables()
{ {
$this->tables = array('Entity', 'User', 'Group', 'GroupUser', 'Account', 'Album', 'Phonenumber', 'Email', 'Book'); $this->tables = array('Entity', 'User', 'Group', 'GroupUser', 'Account', 'Album', 'Phonenumber', 'Email', 'Book');
parent::prepareTables(); parent::prepareTables();
} }
public function testDiffForSimpleCollection() public function testDiffForSimpleCollection()

View File

@ -121,7 +121,7 @@ class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase {
Doctrine::PORTABILITY_RTRIM | Doctrine::PORTABILITY_FIX_CASE); Doctrine::PORTABILITY_RTRIM | Doctrine::PORTABILITY_FIX_CASE);
} }
public function testDefaultListenerIsDoctrineEventListener() { public function testDefaultListenerIsDoctrineEventListener() {
$this->assertTrue($this->manager->getAttribute(Doctrine::ATTR_LISTENER) instanceof Doctrine_EventListener); $this->assertTrue($this->manager->getAttribute(Doctrine::ATTR_LISTENER) instanceof Doctrine_EventListener);
} }
public function testListenerAttributeAcceptsEventListenerObjects() { public function testListenerAttributeAcceptsEventListenerObjects() {
$this->manager->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_Debugger()); $this->manager->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_Debugger());

View File

@ -81,7 +81,7 @@ class Doctrine_CustomResultSetOrder_TestCase extends Doctrine_UnitTestCase {
*/ */
public function prepareTables() { public function prepareTables() {
$this->tables[] = "CategoryWithPosition"; $this->tables[] = "CategoryWithPosition";
$this->tables[] = "BoardWithPosition"; $this->tables[] = "BoardWithPosition";
parent::prepareTables(); parent::prepareTables();
} }
/** /**

View File

@ -183,7 +183,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
public function testListeningErrorHandlingMethodsOnExec() public function testListeningErrorHandlingMethodsOnExec()
{ {
$this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false); $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
$listener = $this->conn->getListener()->get(0); $listener = $this->conn->getListener()->get(0);
$this->conn->exec('DELETE FROM unknown'); $this->conn->exec('DELETE FROM unknown');
@ -195,7 +195,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
public function testListeningErrorHandlingMethodsOnQuery() public function testListeningErrorHandlingMethodsOnQuery()
{ {
$this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false); $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
$listener = $this->conn->getListener()->get(0); $listener = $this->conn->getListener()->get(0);
$this->conn->execute('DELETE FROM unknown'); $this->conn->execute('DELETE FROM unknown');
@ -207,7 +207,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
public function testListeningErrorHandlingMethodsOnPrepare() public function testListeningErrorHandlingMethodsOnPrepare()
{ {
$this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false); $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
$listener = $this->conn->getListener()->get(0); $listener = $this->conn->getListener()->get(0);
$this->conn->prepare('INSERT INTO unknown (id) VALUES (?)'); $this->conn->prepare('INSERT INTO unknown (id) VALUES (?)');
@ -220,7 +220,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
public function testListeningErrorHandlingMethodsOnStatementExecute() public function testListeningErrorHandlingMethodsOnStatementExecute()
{ {
$this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false); $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
$listener = $this->conn->getListener()->get(0); $listener = $this->conn->getListener()->get(0);
$stmt = $this->conn->prepare('INSERT INTO entity (id) VALUES (?)'); $stmt = $this->conn->prepare('INSERT INTO entity (id) VALUES (?)');
@ -315,7 +315,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
} }
public function testInvalidDSN() public function testInvalidDSN()
{ {
$manager = Doctrine_Manager::getInstance(); $manager = Doctrine_Manager::getInstance();
try { try {
$this->conn = $manager->openConnection(''); $this->conn = $manager->openConnection('');
$this->fail(); $this->fail();
@ -337,7 +337,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
} }
public function testInvalidScheme() public function testInvalidScheme()
{ {
$manager = Doctrine_Manager::getInstance(); $manager = Doctrine_Manager::getInstance();
try { try {
$this->conn = $manager->openConnection('unknown://:memory:'); $this->conn = $manager->openConnection('unknown://:memory:');
$this->fail(); $this->fail();
@ -347,7 +347,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
} }
public function testInvalidHost() public function testInvalidHost()
{ {
$manager = Doctrine_Manager::getInstance(); $manager = Doctrine_Manager::getInstance();
try { try {
$this->conn = $manager->openConnection('mysql://user:password@'); $this->conn = $manager->openConnection('mysql://user:password@');
$this->fail(); $this->fail();
@ -357,7 +357,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
} }
public function testInvalidDatabase() public function testInvalidDatabase()
{ {
$manager = Doctrine_Manager::getInstance(); $manager = Doctrine_Manager::getInstance();
try { try {
$this->conn = $manager->openConnection('mysql://user:password@host/'); $this->conn = $manager->openConnection('mysql://user:password@host/');
$this->fail(); $this->fail();

View File

@ -78,10 +78,10 @@ class AdapterMock implements Doctrine_Adapter_Interface {
} }
public function lastInsertId() public function lastInsertId()
{ {
$this->queries[] = 'LAST_INSERT_ID()'; $this->queries[] = 'LAST_INSERT_ID()';
if ($this->lastInsertIdFail) { if ($this->lastInsertIdFail) {
return null; return null;
} else { } else {
return 1; return 1;
} }
} }
@ -102,7 +102,7 @@ class AdapterMock implements Doctrine_Adapter_Interface {
return strtolower($this->name); return strtolower($this->name);
} }
public function setAttribute($attribute, $value) { public function setAttribute($attribute, $value) {
} }
} }
class AdapterStatementMock { class AdapterStatementMock {

View File

@ -40,7 +40,7 @@ class Doctrine_Expression_TestCase extends Doctrine_UnitTestCase
} }
public function prepareData() public function prepareData()
{ {
} }
public function testSavingWithAnExpression() public function testSavingWithAnExpression()
{ {

View File

@ -40,7 +40,7 @@ class Doctrine_Import_Mssql_TestCase extends Doctrine_UnitTestCase
} }
public function testListTableColumnsExecutesSql() public function testListTableColumnsExecutesSql()
{ {
$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
$this->import->listTableColumns('table'); $this->import->listTableColumns('table');
$this->assertEqual($this->adapter->pop(), "EXEC sp_columns @table_name = table"); $this->assertEqual($this->adapter->pop(), "EXEC sp_columns @table_name = table");

View File

@ -37,16 +37,16 @@ class Doctrine_Import_Schema_Xml_TestCase extends Doctrine_UnitTestCase
$import = new Doctrine_Import_Schema_Xml(); $import = new Doctrine_Import_Schema_Xml();
$import->importSchema('schema.xml', 'classes'); $import->importSchema('schema.xml', 'classes');
if (!file_exists('classes/User.class.php')) { if ( ! file_exists('classes/User.class.php')) {
$this->fail(); $this->fail();
} else { } else {
unlink('classes/User.class.php'); unlink('classes/User.class.php');
} }
if (!file_exists('classes/Group.class.php')) { if ( ! file_exists('classes/Group.class.php')) {
$this->fail(); $this->fail();
} else { } else {
unlink('classes/Group.class.php'); unlink('classes/Group.class.php');
} }
} }
} }

View File

@ -37,16 +37,16 @@ class Doctrine_Import_Schema_Yml_TestCase extends Doctrine_UnitTestCase
$import = new Doctrine_Import_Schema_Yml(); $import = new Doctrine_Import_Schema_Yml();
$import->importSchema('schema.yml', 'classes'); $import->importSchema('schema.yml', 'classes');
if (!file_exists('classes/User.class.php')) { if ( ! file_exists('classes/User.class.php')) {
$this->fail(); $this->fail();
} else { } else {
unlink('classes/User.class.php'); unlink('classes/User.class.php');
} }
if (!file_exists('classes/Group.class.php')) { if ( ! file_exists('classes/Group.class.php')) {
$this->fail(); $this->fail();
} else { } else {
unlink('classes/Group.class.php'); unlink('classes/Group.class.php');
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More