1
0
mirror of synced 2025-01-17 22:11:41 +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 NULL_EMPTY_STRING = 1;
const NULL_NATURAL = 0;
const NULL_TO_STRING = NULL;
const NULL_TO_STRING = NULL;
const PARAM_BOOL = 5;
const PARAM_INPUT_OUTPUT = -2147483648;
const PARAM_INT = 1;
@ -480,7 +480,7 @@ final class Doctrine
if (class_exists($classname, false)) {
return false;
}
if (! self::$path) {
if ( ! self::$path) {
self::$path = dirname(__FILE__);
}
$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)
{
$ret = array();
$ret = array();
switch (gettype($var)) {
case 'array':
$ret[] = 'Array(';

View File

@ -145,12 +145,12 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter
$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
$this->_config['options'] = array();
}
if (!isset($this->_config['options']['autocommit'])) {
if ( ! isset($this->_config['options']['autocommit'])) {
// set execution mode
$this->_config['options']['autocommit'] = &$this->_execute_mode;
}
@ -181,7 +181,7 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter
}
// check the connection
if (!$this->_connection) {
if ( ! $this->_connection) {
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()
{
if (!db2_commit($this->_connection)) {
if ( ! db2_commit($this->_connection)) {
throw new Doctrine_Adapter_Db2_Exception(
db2_conn_errormsg($this->_connection),
db2_conn_error($this->_connection));
@ -302,7 +302,7 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter
*/
protected function _rollBack()
{
if (!db2_rollback($this->_connection)) {
if ( ! db2_rollback($this->_connection)) {
throw new Doctrine_Adapter_Db2_Exception(
db2_conn_errormsg($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;
if( ! empty($e)) {
if ( ! empty($e)) {
$name = $e[0];
$this->exception = array();
@ -101,7 +101,7 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable
$e = $this->exception;
if( ! empty($e)) {
if ( ! empty($e)) {
$name = $e[0];
$this->exception = array();
@ -121,16 +121,16 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable
}
public function lastInsertId()
{
$this->queries[] = 'LAST_INSERT_ID()';
if ($this->lastInsertIdFail) {
$this->queries[] = 'LAST_INSERT_ID()';
if ($this->lastInsertIdFail) {
return null;
} else {
} else {
return 1;
}
}
public function count()
{
return count($this->queries);
return count($this->queries);
}
public function beginTransaction()
{
@ -150,12 +150,12 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable
{ }
public function getAttribute($attribute)
{
if($attribute == Doctrine::ATTR_DRIVER_NAME)
if ($attribute == Doctrine::ATTR_DRIVER_NAME)
return strtolower($this->name);
}
public function setAttribute($attribute, $value)
{
}
public function sqliteCreateFunction()
{ }

View File

@ -110,7 +110,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
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');
}
@ -126,7 +126,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
}
// check the connection
if (!$this->_connection) {
if ( ! $this->_connection) {
throw new Doctrine_Adapter_Oracle_Exception(oci_error());
}
}
@ -199,7 +199,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
*/
protected function _commit()
{
if (!oci_commit($this->_connection)) {
if ( ! oci_commit($this->_connection)) {
throw new Doctrine_Adapter_Oracle_Exception(oci_error($this->_connection));
}
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
@ -212,7 +212,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
*/
protected function _rollBack()
{
if (!oci_rollback($this->_connection)) {
if ( ! oci_rollback($this->_connection)) {
throw new Doctrine_Adapter_Oracle_Exception(oci_error($this->_connection));
}
$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)
{
}
/**
* bindValue
@ -72,7 +72,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
*/
public function bindValue($param, $value, $type = null)
{
}
/**
* 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())
{
}
/**
* closeCursor
@ -125,7 +125,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
*/
public function columnCount()
{
return 0;
return 0;
}
/**
* errorCode
@ -216,7 +216,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
*/
public function execute($params = null)
{
if(is_object($this->mock)) {
if (is_object($this->mock)) {
$this->mock->addQuery($this->queryString);
}
return true;

View File

@ -40,7 +40,7 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener
}
public function preInsert(Doctrine_Event $event)
{
$versionColumn = $this->_auditLog->getOption('versionColumn');
$versionColumn = $this->_auditLog->getOption('versionColumn');
$event->getInvoker()->set($versionColumn, 1);
}
@ -54,23 +54,23 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener
$version->merge($record->toArray());
$version->save();
$versionColumn = $this->_auditLog->getOption('versionColumn');
$version = $record->get($versionColumn);
$versionColumn = $this->_auditLog->getOption('versionColumn');
$version = $record->get($versionColumn);
$record->set($versionColumn, ++$version);
}
public function preUpdate(Doctrine_Event $event)
{
$class = $this->_auditLog->getOption('className');
$class = $this->_auditLog->getOption('className');
$record = $event->getInvoker();
$version = new $class();
$version->merge($record->toArray());
$version->save();
$versionColumn = $this->_auditLog->getOption('versionColumn');
$versionColumn = $this->_auditLog->getOption('versionColumn');
$version = $record->get($versionColumn);
$version = $record->get($versionColumn);
$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())
{
if (is_object($driver)) {
if ( ! ($driver instanceof Doctrine_Cache_Interface)) {
throw new Doctrine_Cache_Exception('Driver should implement Doctrine_Cache_Interface.');
}
$this->_driver = $driver;
$this->_driver->setOptions($options);
if (is_object($driver)) {
if ( ! ($driver instanceof Doctrine_Cache_Interface)) {
throw new Doctrine_Cache_Exception('Driver should implement Doctrine_Cache_Interface.');
}
$this->_driver = $driver;
$this->_driver->setOptions($options);
} else {
$class = 'Doctrine_Cache_' . ucwords(strtolower($driver));
@ -103,12 +103,12 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
*/
public function setOption($option, $value)
{
// sanity check (we need this since we are using isset() instead of array_key_exists())
if ($value === null) {
// sanity check (we need this since we are using isset() instead of array_key_exists())
if ($value === null) {
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;
return true;
}
@ -138,7 +138,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
*/
public function add($query, $namespace = null)
{
if (isset($namespace)) {
if (isset($namespace)) {
$this->_queries[$namespace][] = $query;
} else {
$this->_queries[] = $query;
@ -153,7 +153,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
public function getAll($namespace = null)
{
if (isset($namespace)) {
if( ! isset($this->_queries[$namespace])) {
if ( ! isset($this->_queries[$namespace])) {
return array();
}
@ -216,7 +216,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
{
$rand = (mt_rand() / mt_getrandmax());
if ($rand <= $this->_options['cleanPropability']) {
if ($rand <= $this->_options['cleanPropability']) {
$queries = $this->readStats();
$stats = array();
@ -249,14 +249,14 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
*/
public function readStats()
{
if ($this->_options['statsFile'] !== false) {
$content = file_get_contents($this->_options['statsFile']);
if ($this->_options['statsFile'] !== false) {
$content = file_get_contents($this->_options['statsFile']);
$e = explode("\n", $content);
return array_map('unserialize', $e);
}
return array();
}
return array();
}
/**
* appendStats
@ -266,7 +266,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
*/
public function appendStats()
{
if ($this->_options['statsFile'] !== false) {
if ($this->_options['statsFile'] !== false) {
if ( ! file_exists($this->_options['statsFile'])) {
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)
{
$ret = current($this->_data);
next($this->_data);
next($this->_data);
return $ret;
}
/**

View File

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

View File

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

View File

@ -113,7 +113,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*/
public function setData(array $data)
{
$this->data = $data;
$this->data = $data;
}
/**
* 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)
{
if ($key === null || ! isset($this->data[$key])) {
$record = $this->_table->create();
if ($key === null || ! isset($this->data[$key])) {
$record = $this->_table->create();
if (isset($this->referenceField)) {
$value = $this->reference->get($this->relation->getLocal());
@ -316,7 +316,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$this->data[] = $record;
return $record;
}
}
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)
{
if (is_object($adapter)) {
if (is_object($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');
}
@ -171,7 +171,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
$this->isConnected = true;
} elseif(is_array($adapter)) {
} elseif (is_array($adapter)) {
$this->pendingAttributes[Doctrine::ATTR_DRIVER_NAME] = $adapter['scheme'];
$this->options['dsn'] = $adapter['dsn'];
@ -196,12 +196,12 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
public function getAttribute($attribute)
{
if ($attribute >= 100) {
if ($attribute >= 100) {
if ( ! isset($this->attributes[$attribute])) {
return $this->parent->getAttribute($attribute);
}
return $this->attributes[$attribute];
}
}
if ($this->isConnected) {
try {
@ -235,9 +235,9 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/
public function setAttribute($attribute, $value)
{
if ($attribute >= 100) {
if ($attribute >= 100) {
parent::setAttribute($attribute, $value);
} else {
} else {
if ($this->isConnected) {
$this->dbh->setAttribute($attribute, $value);
} else {
@ -310,8 +310,8 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/
public function getDbh()
{
$this->connect();
$this->connect();
return $this->dbh;
}
/**
@ -348,14 +348,14 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
if (class_exists($class)) {
$this->dbh = new $class($this->options['dsn'], $this->options['username'], $this->options['password']);
} 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
foreach($this->pendingAttributes as $attr => $value) {
// 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;
}
$this->dbh->setAttribute($attr, $value);
@ -540,7 +540,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/
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, '.')) {
$e = explode('.', $str);
@ -781,7 +781,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/
public function execute($query, array $params = array())
{
$this->connect();
$this->connect();
try {
if ( ! empty($params)) {
@ -815,7 +815,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
* @return PDOStatement|Doctrine_Adapter_Statement
*/
public function exec($query, array $params = array()) {
$this->connect();
$this->connect();
try {
if ( ! empty($params)) {
@ -849,9 +849,9 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/
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';
@ -1011,7 +1011,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/
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);
@ -1039,7 +1039,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/
public function errorCode()
{
$this->connect();
$this->connect();
return $this->dbh->errorCode();
}
@ -1051,7 +1051,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*/
public function errorInfo()
{
$this->connect();
$this->connect();
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)
{
$limit = (int) $limit;
$offset = (int) $offset;
$limit = (int) $limit;
$offset = (int) $offset;
if ($limit && $offset) {
$query .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
} elseif ($limit && ! $offset) {

View File

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

View File

@ -61,8 +61,8 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
* @return boolean
*/
public function setFilterQueryType() {
}
}
/**
* method overloader
* 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
$a[0]->start();
if( ! in_array($a[0], $this->events, true)) {
if ( ! in_array($a[0], $this->events, true)) {
$this->events[] = $a[0];
}
} else {
@ -126,7 +126,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
*/
public function getAll()
{
return $this->events;
return $this->events;
}
/**
* getIterator

View File

@ -89,7 +89,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
*/
public function bindColumn($column, $param, $type = null)
{
if($type === null) {
if ($type === null) {
return $this->_stmt->bindColumn($column, $param);
} else {
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)
{
if($type === null) {
if ($type === null) {
return $this->_stmt->bindValue($param, $value);
} else {
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())
{
if($type === null) {
if ($type === null) {
return $this->_stmt->bindParam($column, $variable);
} else {
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)
{
$conn = $this->getConnection();
$conn = $this->getConnection();
$state = $record->state();
if ($state === Doctrine_Record::STATE_LOCKED) {
@ -319,7 +319,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record = false;
$ids = array();
if (is_array($deletes[count($deletes)-1]->getTable()->getIdentifier())) {
if (is_array($deletes[count($deletes)-1]->getTable()->getIdentifier())) {
if (count($deletes) > 0) {
$query = 'DELETE FROM '
. $this->conn->quoteIdentifier($deletes[0]->getTable()->getTableName())
@ -330,7 +330,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
foreach ($deletes as $k => $record) {
$ids = $record->identifier();
$tmp = array();
foreach (array_keys($ids) as $id){
foreach (array_keys($ids) as $id) {
$tmp[] = $id . ' = ? ';
}
$params = array_merge($params, array_values($ids));
@ -340,22 +340,22 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$this->conn->execute($query, $params);
}
} else {
foreach ($deletes as $k => $record) {
} else {
foreach ($deletes as $k => $record) {
$ids[] = $record->getIncremented();
}
if ($record instanceof Doctrine_Record) {
$params = substr(str_repeat('?, ', count($ids)), 0, -2);
}
if ($record instanceof Doctrine_Record) {
$params = substr(str_repeat('?, ', count($ids)), 0, -2);
$query = 'DELETE FROM '
. $this->conn->quoteIdentifier($record->getTable()->getTableName())
. ' WHERE '
. $record->getTable()->getIdentifier()
. ' IN(' . $params . ')';
$query = 'DELETE FROM '
. $this->conn->quoteIdentifier($record->getTable()->getTableName())
. ' WHERE '
. $record->getTable()->getIdentifier()
. ' 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->delete($this->conn);
}
break;
}

View File

@ -43,7 +43,7 @@ class Doctrine_DataDict extends Doctrine_Connection_Module
{
$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');
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -360,9 +360,9 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
*/
public function getNativeDeclaration(array $field)
{
if ( ! isset($field['type'])) {
if ( ! isset($field['type'])) {
throw new Doctrine_DataDict_Exception('Missing column type.');
}
}
switch ($field['type']) {
case 'char':
case 'string':
@ -385,8 +385,8 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
case 'enum':
case 'integer':
case 'int':
if (!empty($field['autoincrement'])) {
if (!empty($field['length'])) {
if ( ! empty($field['autoincrement'])) {
if ( ! empty($field['length'])) {
$length = $field['length'];
if ($length > 4) {
return 'BIGSERIAL';
@ -394,7 +394,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
}
return 'SERIAL';
}
if (!empty($field['length'])) {
if ( ! empty($field['length'])) {
$length = $field['length'];
if ($length <= 2) {
return 'SMALLINT';
@ -578,7 +578,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
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";
}
*/

View File

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

View File

@ -34,16 +34,16 @@ class Doctrine_DataType
{
public function __construct()
{
}
public function getName()
{
}
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())
{
$sql = (array) $this->createTableSql($name, $fields, $options);
$sql = (array) $this->createTableSql($name, $fields, $options);
foreach ($sql as $query) {
$this->conn->execute($query);
@ -423,7 +423,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$name = $this->conn->quoteIdentifier($name);
$type = '';
if(isset($definition['type'])) {
if (isset($definition['type'])) {
switch (strtolower($definition['type'])) {
case 'unique':
$type = strtoupper($definition['type']) . ' ';
@ -760,9 +760,9 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/
public function getIndexFieldDeclarationList(array $fields)
{
$ret = array();
$ret = array();
foreach ($fields as $field => $definition) {
if(is_array($definition)) {
if (is_array($definition)) {
$ret[] = $this->conn->quoteIdentifier($field);
} else {
$ret[] = $this->conn->quoteIdentifier($definition);
@ -868,7 +868,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/
public function getForeignKeyReferentialAction($action)
{
$upper = strtoupper($action);
$upper = strtoupper($action);
switch ($upper) {
case 'CASCADE':
case 'SET NULL':
@ -891,7 +891,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/
public function getForeignKeyBaseDeclaration(array $definition)
{
$sql = '';
$sql = '';
if (isset($definition['name'])) {
$sql .= 'CONSTRAINT ' . $this->conn->quoteIdentifier($definition['name']) . ' ';
}
@ -982,7 +982,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$this->conn->exec($query);
} catch (Doctrine_Connection_Exception $e) {
// 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();
throw $e;
}
@ -1010,7 +1010,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$this->conn->exec($query);
} catch (Doctrine_Connection_Exception $e) {
// 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();
throw $e;
}
@ -1093,10 +1093,10 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/
public function exportSql($directory = null)
{
$declared = get_declared_classes();
$declared = get_declared_classes();
if ($directory !== null) {
foreach ((array) $directory as $dir) {
if ($directory !== null) {
foreach ((array) $directory as $dir) {
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir),
RecursiveIteratorIterator::LEAVES_ONLY);
@ -1123,8 +1123,8 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/
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())) {
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']);
} catch(Doctrine_Connection_Exception $e) {
// 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;
}
}

View File

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

View File

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

View File

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

View File

@ -93,7 +93,7 @@ class Doctrine_Export_Oracle extends Doctrine_Export
*/
public function _makeAutoincrement($name, $table, $start = 1)
{
$sql = array();
$sql = array();
$table = strtoupper($table);
$indexName = $table . '_AI_PK';
$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']);
$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';
$this->conn->exec('ALTER TABLE ' . $name . ' ' . $query);
}

View File

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

View File

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

View File

@ -296,7 +296,7 @@ class Doctrine_Expression_Driver extends Doctrine_Connection_Module
*/
public function concat()
{
$args = func_get_args();
$args = func_get_args();
return 'CONCAT(' . join(', ', (array) $args) . ')';
}
@ -703,7 +703,7 @@ class Doctrine_Expression_Driver extends Doctrine_Connection_Module
*/
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);
}
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)
{
$match = '';
if (!is_null($operator)) {
if ( ! is_null($operator)) {
$field = is_null($field) ? '' : $field.' ';
$operator = strtoupper($operator);
switch ($operator) {

View File

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

View File

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

View File

@ -81,7 +81,7 @@ class Doctrine_Hook
} elseif ($query instanceof Doctrine_Query) {
$this->query = $query;
} 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();

View File

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

View File

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

View File

@ -52,7 +52,7 @@ class Doctrine_Hydrate_Record extends Doctrine_Object
}
public function initRelated($record, $name)
{
if ( ! is_array($record)) {
if ( ! is_array($record)) {
$record[$name];
return true;
@ -74,7 +74,7 @@ class Doctrine_Hydrate_Record extends Doctrine_Object
*/
public function isIdentifiable(array $row, Doctrine_Table $table)
{
$primaryKeys = $table->getIdentifier();
$primaryKeys = $table->getIdentifier();
if (is_array($primaryKeys)) {
foreach ($primaryKeys as $id) {
@ -95,7 +95,7 @@ class Doctrine_Hydrate_Record extends Doctrine_Object
}
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]->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, false);
}

View File

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

View File

@ -31,16 +31,16 @@ Doctrine::autoload('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'",
'listColumns' => "SELECT c.colname, c.coltype, c.collength, d.default, c.colno
FROM syscolumns c, systables t,outer sysdefaults d
WHERE c.tabid = t.tabid AND d.tabid = t.tabid AND d.colno = c.colno
AND tabname='%s' ORDER BY c.colno",
'listPk' => "SELECT part1, part2, part3, part4, part5, part6, part7, part8 FROM
systables t, sysconstraints s, sysindexes i WHERE t.tabname='%s'
AND s.tabid=t.tabid AND s.constrtype='P'
AND i.idxname=s.idxname",
FROM syscolumns c, systables t,outer sysdefaults d
WHERE c.tabid = t.tabid AND d.tabid = t.tabid AND d.colno = c.colno
AND tabname='%s' ORDER BY c.colno",
'listPk' => "SELECT part1, part2, part3, part4, part5, part6, part7, part8 FROM
systables t, sysconstraints s, sysindexes i WHERE t.tabname='%s'
AND s.tabid=t.tabid AND s.constrtype='P'
AND i.idxname=s.idxname",
'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.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();
foreach ($indexes as $index) {
if (!in_array($index, $pkAll) && $index != null) {
if ( ! in_array($index, $pkAll) && $index != null) {
$result[] = $this->conn->formatter->fixIndexName($index);
}
}

View File

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

View File

@ -197,7 +197,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import
*/
public function listUsers()
{
/**
/**
if ($this->conn->options['emulate_database'] && $this->conn->options['database_name_prefix']) {
$query = 'SELECT SUBSTR(username, ';
$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);
$tableNames = $dataDict->listTables();
foreach ($tableNames as $tableName){
foreach ($tableNames as $tableName) {
$table = new Doctrine_Schema_Table();
$table->set("name",$tableName);
$tableColumns = $dataDict->listTableColumns($tableName);
foreach ($tableColumns as $tableColumn){
foreach ($tableColumns as $tableColumn) {
$table->addColumn($tableColumn);
}
$this->conn->addTable($table);
if ($fks = $dataDict->listTableConstraints($tableName)){
foreach ($fks as $fk){
if ($fks = $dataDict->listTableConstraints($tableName)) {
foreach ($fks as $fk) {
$relation = new Doctrine_Schema_Relation();
$relation->setRelationBetween($fk['referencingColumn'],$fk['referencedTable'],$fk['referencedColumn']);
$table->setRelation($relation);

View File

@ -39,19 +39,19 @@
*/
class Doctrine_Import_Schema_Xml extends Doctrine_Import_Schema
{
/**
* parse
*
* @param string $schema
* @return void
*/
/**
* parse
*
* @param string $schema
* @return void
*/
public function parse($schema)
{
if (!is_readable($schema)) {
if ( ! is_readable($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');
}
@ -101,4 +101,4 @@ class Doctrine_Import_Schema_Xml extends Doctrine_Import_Schema
return $tables;
}
}
}

View File

@ -39,19 +39,19 @@
*/
class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
{
/**
* parse
*
* @param string $schema
* @return void
*/
/**
* parse
*
* @param string $schema
* @return void
*/
public function parse($schema)
{
if (!is_readable($schema)) {
if ( ! is_readable($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)
{
$array = $this->parse($schema);
$tables = array();
// Not working yet
/*
$tables = array();
// Not working yet
/*
// Go through all tables...
foreach ($array['table'] as $table) {
// Go through all columns...
@ -93,8 +93,8 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
$tables[(string) $table['name']] = $columns;
}
*/
*/
return $tables;
}
}
}

View File

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

View File

@ -83,7 +83,7 @@ class Doctrine_Lib
* @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);
if ( $collection->count != 0) {
@ -106,7 +106,7 @@ class Doctrine_Lib
return $xml->asXML();
}
public static function plurelize($string){
public static function plurelize($string) {
return $string . "s";
}
@ -131,10 +131,10 @@ class Doctrine_Lib
if ( !isset($incomming_xml)) {
$new_xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><" . $recordname . "></" . $recordname . ">";
$xml = new SimpleXMLElement($new_xml_string);
}else{
} else {
$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_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 ($value instanceOf Doctrine_Null) {
$xml->addChild($field);
} else {
} else {
$xml->addChild($field, $value);
}
}
}
if (!isset($xml_options["include_relations"])) {
if ( ! isset($xml_options["include_relations"])) {
return $xml->asXML();
}
$relations = $record->getTable()->getRelations();

View File

@ -217,7 +217,7 @@ class Doctrine_Locking_Manager_Pessimistic
$stmt->bindParam(':object_key', $key);
$success = $stmt->execute();
if (!$success) {
if ( ! $success) {
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)
{
if (is_object($adapter)) {
if (is_object($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");
}
@ -202,7 +202,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
}
$e = explode(':', $adapter[0]);
if($e[0] == 'uri') {
if ($e[0] == 'uri') {
$e[0] = 'odbc';
}

View File

@ -83,7 +83,7 @@ class Doctrine_Node implements IteratorAggregate
{
$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");
}

View File

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

View File

@ -154,7 +154,7 @@ class Doctrine_Node_NestedSet_PreOrderIterator implements Iterator
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();
$this->level += $this->prevLeft - $left + 2;
$this->prevLeft = $left;

View File

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

View File

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

View File

@ -88,7 +88,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
$value = $value->getSql();
unset($values[$k]);
} else {
$value = '?';
$value = '?';
}
$a[] = $value;
}
@ -184,7 +184,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
*/
public function delete()
{
$this->type = self::DELETE;
$this->type = self::DELETE;
return $this;
}
@ -197,7 +197,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
*/
public function update($update)
{
$this->type = self::UPDATE;
$this->type = self::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)
{
if (is_array($key)) {
if (is_array($key)) {
foreach ($key as $k => $v) {
$this->set($k, '?', array($v));
$this->set($k, '?', array($v));
}
} else {
} else {
if ($params !== null) {
if (is_array($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);
if(count($e) > 2) {
if (count($e) > 2) {
$a = explode('.', $e[0]);
$field = array_pop($a);
$reference = implode('.', $a);

View File

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

View File

@ -129,7 +129,7 @@ class Doctrine_RawSql extends Doctrine_Query_Abstract
*/
public function getQuery()
{
$select = array();
$select = array();
foreach ($this->fields as $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)
{
if($stack !== null) {
if( ! ($stack instanceof Doctrine_Validator_ErrorStack)) {
if ($stack !== null) {
if ( ! ($stack instanceof Doctrine_Validator_ErrorStack)) {
throw new Doctrine_Record_Exception('Argument should be an instance of Doctrine_Validator_ErrorStack.');
}
$this->_errorStack = $stack;
@ -413,7 +413,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/
public function cleanData(&$data)
{
$tmp = $data;
$tmp = $data;
$data = array();
foreach ($this->getTable()->getColumnNames() as $name) {
@ -483,7 +483,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/
public function serialize()
{
$event = new Doctrine_Event($this, Doctrine_Event::RECORD_SERIALIZE);
$event = new Doctrine_Event($this, Doctrine_Event::RECORD_SERIALIZE);
$this->preSerialize($event);
@ -536,9 +536,9 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/
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();
$connection = $manager->getConnectionForComponent(get_class($this));
@ -674,7 +674,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
{
if (is_null($name)) {
foreach ($this->_table->getRelations() as $rel) {
$this->_references[$rel->getAlias()] = $rel->fetchRelatedFor($this);
$this->_references[$rel->getAlias()] = $rel->fetchRelatedFor($this);
}
} else {
$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) {
$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);
else
$this->set($rel->getLocal(), $value, false);
@ -933,7 +933,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
return true;
}
if (isset($this->_values[$lower])) {
return true;
return true;
}
if (isset($this->_references[$name]) &&
$this->_references[$name] !== self::$_null) {
@ -1202,7 +1202,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/
public function copy()
{
$data = $this->_data;
$data = $this->_data;
if ($this->_table->getIdentifierType() === Doctrine::IDENTIFIER_AUTOINC) {
$id = $this->_table->getIdentifier();
@ -1228,7 +1228,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*
* @return Doctrine_Record
*/
public function copyDeep(){
public function copyDeep() {
$copy = $this->copy();
foreach ($this->_references as $key => $value) {

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ class Doctrine_Relation_Association extends Doctrine_Relation
}
public function getAssociationTable()
{
return $this->definition['refTable'];
return $this->definition['refTable'];
}
/**
* getRelationDql
@ -54,7 +54,7 @@ class Doctrine_Relation_Association extends Doctrine_Relation
*/
public function getRelationDql($count, $context = 'record')
{
$component = $this->definition['refTable']->getComponentName();
$component = $this->definition['refTable']->getComponentName();
switch ($context) {
case "record":
$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)
{
$id = array();
foreach ((array) $this->definition['local'] as $local) {
$value = $record->get($local);
$id = array();
foreach ((array) $this->definition['local'] as $local) {
$value = $record->get($local);
if (isset($value)) {
$id[] = $value;
}
@ -86,10 +86,10 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
*/
public function getCondition($alias = null)
{
if ( ! $alias) {
$alias = $this->getTable()->getComponentName();
}
$conditions = array();
if ( ! $alias) {
$alias = $this->getTable()->getComponentName();
}
$conditions = array();
foreach ((array) $this->definition['foreign'] as $foreign) {
$conditions[] = $alias . '.' . $foreign . ' = ?';
}

View File

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

View File

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

View File

@ -96,7 +96,7 @@ class Doctrine_Schema_Table extends Doctrine_Schema_Object implements Countable,
* @param Doctrine_Schema_Relation Relation
*
*/
public function setRelation(Doctrine_Schema_Relation $relation){
public function setRelation(Doctrine_Schema_Relation $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
*/
public function getRelations(){
public function getRelations() {
return $this->relations;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,7 +39,7 @@ class Doctrine_Template_Versionable extends Doctrine_Template
}
public function setUp()
{
$this->_auditLog->setOption('table', $this->_table);
$this->_auditLog->setOption('table', $this->_table);
$this->_auditLog->buildDefinition($this->_table);
$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 = ')')
{
if(is_array($d)) {
if (is_array($d)) {
$a = preg_split('/('.implode('|', $d).')/', $str);
$d = stripslashes($d[0]);
} else {
@ -93,7 +93,7 @@ class Doctrine_Tokenizer
$s1 = substr_count($term[$i], $e1);
$s2 = substr_count($term[$i], $e2);
if($s1 == $s2) {
if ($s1 == $s2) {
$i++;
}
} else {
@ -101,7 +101,7 @@ class Doctrine_Tokenizer
$c1 = substr_count($term[$i], $e1);
$c2 = substr_count($term[$i], $e2);
if($c1 == $c2) {
if ($c1 == $c2) {
$i++;
}
}
@ -210,7 +210,7 @@ class Doctrine_Tokenizer
$s2 = substr_count($term[$i], $e2);
if (strpos($term[$i], '(') !== false) {
if($s1 == $s2) {
if ($s1 == $s2) {
$i++;
}
} else {
@ -225,7 +225,7 @@ class Doctrine_Tokenizer
$c2 = substr_count($term[$i], $e2);
if (strpos($term[$i], '(') !== false) {
if($c1 == $c2) {
if ($c1 == $c2) {
$i++;
}
} else {
@ -300,7 +300,7 @@ class Doctrine_Tokenizer
$c2 = substr_count($term[$i], $e2);
if (strpos($term[$i], '(') !== false) {
if($c1 == $c2) {
if ($c1 == $c2) {
$i++;
}
} else {

View File

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

View File

@ -95,7 +95,7 @@ class Doctrine_Tree
public static function factory(Doctrine_Table $table, $implName, $options = array())
{
$class = 'Doctrine_Tree_' . $implName;
if (!class_exists($class)) {
if ( ! class_exists($class)) {
throw new Doctrine_Exception('The chosen class must extend Doctrine_Tree');
}
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
$options['hasManyRoots'] = isset($options['hasManyRoots']) ? $options['hasManyRoots'] : false;
if($options['hasManyRoots'])
if ($options['hasManyRoots'])
$options['rootColumnName'] = isset($options['rootColumnName']) ? $options['rootColumnName'] : 'root_id';
parent::__construct($table, $options);
@ -266,7 +266,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
*/
public function getBaseQuery()
{
if (!isset($this->_baseQuery)) {
if ( ! isset($this->_baseQuery)) {
$this->_baseQuery = $this->_createBaseQuery();
}
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 (!$this->validateLength($column, $key, $value)) {
if ( ! $this->validateLength($column, $key, $value)) {
$errorStack->add($key, 'length');
continue;
@ -119,7 +119,7 @@ class Doctrine_Validator extends Doctrine_Object
if (strtolower($name) == 'length') {
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');
}
}

View File

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

View File

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

View File

@ -41,9 +41,9 @@ class Doctrine_Validator_Regexp
*/
public function validate($value)
{
if ( ! isset($this->args)) {
return true;
}
if ( ! isset($this->args)) {
return true;
}
if (is_array($this->args)) {
foreach ($this->args as $regexp) {
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
// as the one that is validated here.
$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) {
$sql .= " AND {$pk} != ?";
$values[] = $this->invoker->$pk;

View File

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

View File

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

View File

@ -49,11 +49,11 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
*/
public function testAdapterQueryChecksCache()
{
$query = 'SELECT * FROM user';
$query = 'SELECT * FROM user';
$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();
@ -65,11 +65,11 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
}
public function testAdapterStatementExecuteChecksCache()
{
$query = 'SELECT * FROM user WHERE id = ?';
$query = 'SELECT * FROM user WHERE id = ?';
$params = array(1);
$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();
@ -115,13 +115,13 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
}
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 = ?');
@ -131,9 +131,9 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
}
public function testAppendStatsWritesQueriesToStatsFile()
{
$this->cache->setOption('addStatsPropability', 1);
$data = array(1,2,3);
$this->cache->setOption('addStatsPropability', 1);
$data = array(1,2,3);
$this->cache->add('SELECT * FROM user');
$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()
{
$this->cache->setOption('cleanPropability', 1);
$this->cache->setOption('cleanPropability', 1);
$this->cache->add('SELECT * FROM user');
$this->cache->add(array('SELECT * FROM user WHERE id = ?', array(1)));
@ -164,7 +164,7 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
{
parent::setUp();
if ( ! isset($this->cache)) {
if ( ! isset($this->cache)) {
$this->cache = new Doctrine_Cache('Array');
$this->cache->setOption('cacheFile', false);
$this->cache->setOption('savePropability', 0);

View File

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

View File

@ -121,7 +121,7 @@ class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase {
Doctrine::PORTABILITY_RTRIM | Doctrine::PORTABILITY_FIX_CASE);
}
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() {
$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() {
$this->tables[] = "CategoryWithPosition";
$this->tables[] = "BoardWithPosition";
$this->tables[] = "BoardWithPosition";
parent::prepareTables();
}
/**

View File

@ -183,7 +183,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
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);
$this->conn->exec('DELETE FROM unknown');
@ -195,7 +195,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
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);
$this->conn->execute('DELETE FROM unknown');
@ -207,7 +207,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
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);
$this->conn->prepare('INSERT INTO unknown (id) VALUES (?)');
@ -220,7 +220,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
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);
$stmt = $this->conn->prepare('INSERT INTO entity (id) VALUES (?)');
@ -315,7 +315,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
}
public function testInvalidDSN()
{
$manager = Doctrine_Manager::getInstance();
$manager = Doctrine_Manager::getInstance();
try {
$this->conn = $manager->openConnection('');
$this->fail();
@ -337,7 +337,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
}
public function testInvalidScheme()
{
$manager = Doctrine_Manager::getInstance();
$manager = Doctrine_Manager::getInstance();
try {
$this->conn = $manager->openConnection('unknown://:memory:');
$this->fail();
@ -347,7 +347,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
}
public function testInvalidHost()
{
$manager = Doctrine_Manager::getInstance();
$manager = Doctrine_Manager::getInstance();
try {
$this->conn = $manager->openConnection('mysql://user:password@');
$this->fail();
@ -357,7 +357,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
}
public function testInvalidDatabase()
{
$manager = Doctrine_Manager::getInstance();
$manager = Doctrine_Manager::getInstance();
try {
$this->conn = $manager->openConnection('mysql://user:password@host/');
$this->fail();

View File

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

View File

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

View File

@ -40,7 +40,7 @@ class Doctrine_Import_Mssql_TestCase extends Doctrine_UnitTestCase
}
public function testListTableColumnsExecutesSql()
{
$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
$this->import->listTableColumns('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->importSchema('schema.xml', 'classes');
if (!file_exists('classes/User.class.php')) {
if ( ! file_exists('classes/User.class.php')) {
$this->fail();
} else {
unlink('classes/User.class.php');
}
if (!file_exists('classes/Group.class.php')) {
if ( ! file_exists('classes/Group.class.php')) {
$this->fail();
} else {
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->importSchema('schema.yml', 'classes');
if (!file_exists('classes/User.class.php')) {
if ( ! file_exists('classes/User.class.php')) {
$this->fail();
} else {
unlink('classes/User.class.php');
}
if (!file_exists('classes/Group.class.php')) {
if ( ! file_exists('classes/Group.class.php')) {
$this->fail();
} else {
unlink('classes/Group.class.php');
}
}
}
}

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