replace tabs with 4 spaces. and fix other coding style related stuff
This commit is contained in:
parent
d3e4b2c912
commit
f3a377a794
@ -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';
|
||||
|
@ -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));
|
||||
|
@ -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();
|
||||
@ -150,7 +150,7 @@ 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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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'];
|
||||
@ -355,7 +355,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
// 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);
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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)";
|
||||
|
@ -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'] === '') {
|
||||
|
@ -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';
|
||||
|
@ -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";
|
||||
}
|
||||
*/
|
||||
|
@ -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)) {
|
||||
|
@ -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']) . ' ';
|
||||
@ -762,7 +762,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
$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);
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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':
|
||||
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -102,7 +102,7 @@ class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver
|
||||
* @return string
|
||||
*/
|
||||
public function age($timestamp1, $timestamp2 = null) {
|
||||
if( $timestamp2 == null ) {
|
||||
if ( $timestamp2 == null ) {
|
||||
return 'AGE(' . $timestamp1 . ')';
|
||||
}
|
||||
return 'AGE(' . $timestamp1 . ', ' . $timestamp2 . ')';
|
||||
@ -174,7 +174,7 @@ class Doctrine_Expression_Pgsql 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) {
|
||||
|
@ -184,7 +184,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
|
||||
*/
|
||||
public function getRootAlias()
|
||||
{
|
||||
if (!$this->_aliasMap) {
|
||||
if ( ! $this->_aliasMap) {
|
||||
$this->getSql();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -47,11 +47,11 @@ class Doctrine_Import_Schema_Xml extends Doctrine_Import_Schema
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema
|
||||
*/
|
||||
public function parse($schema)
|
||||
{
|
||||
if (!is_readable($schema)) {
|
||||
if ( ! is_readable($schema)) {
|
||||
throw new Doctrine_Import_Exception('Could not read schema file '. $schema);
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
@ -150,7 +150,7 @@ class Doctrine_Lib
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($xml_options["include_relations"])) {
|
||||
if ( ! isset($xml_options["include_relations"])) {
|
||||
return $xml->asXML();
|
||||
}
|
||||
$relations = $record->getTable()->getRelations();
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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';
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
@ -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);
|
||||
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
@ -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];
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -37,13 +37,13 @@ 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');
|
||||
|
@ -37,13 +37,13 @@ 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');
|
||||
|
@ -145,7 +145,7 @@ class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase {
|
||||
$other = $this->connection->query($query);
|
||||
$check1 = array();
|
||||
foreach($other as $oth) {
|
||||
if(!isset($check1[$oth->other_thing_id])) {
|
||||
if( ! isset($check1[$oth->other_thing_id])) {
|
||||
$check1[$oth->other_thing_id] = array();
|
||||
}
|
||||
$check1[$oth->other_thing_id][$oth->id] = $oth;
|
||||
@ -154,7 +154,7 @@ class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase {
|
||||
$ones = $this->connection->query($query);
|
||||
$check2 = array();
|
||||
foreach($ones as $one) {
|
||||
if(!isset($check2[$one->one_thing_id])) {
|
||||
if( ! isset($check2[$one->one_thing_id])) {
|
||||
$check2[$one->one_thing_id] = array();
|
||||
}
|
||||
$check2[$one->one_thing_id][$one->id] = $one;
|
||||
|
@ -162,10 +162,10 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
|
||||
try {
|
||||
$record = $this->objTable->find('4', Doctrine::FETCH_ARRAY);
|
||||
$this->assertTrue(is_array($record));
|
||||
$this->assertTrue(!is_object($record));
|
||||
$this->assertTrue( ! is_object($record));
|
||||
$this->assertTrue(array_key_exists('id', $record));
|
||||
$this->assertTrue(array_key_exists('name', $record));
|
||||
$this->assertTrue(! $record instanceof Doctrine_Record);
|
||||
$this->assertTrue( ! $record instanceof Doctrine_Record);
|
||||
} catch(Exception $e) {
|
||||
$this->assertTrue(false);
|
||||
}
|
||||
@ -199,9 +199,9 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertTrue($users instanceof Doctrine_Collection);
|
||||
|
||||
$users = $this->objTable->findAll(Doctrine::FETCH_ARRAY);
|
||||
$this->assertTrue(! $users instanceof Doctrine_Collection);
|
||||
$this->assertTrue( ! $users instanceof Doctrine_Collection);
|
||||
$this->assertTrue(is_array($users));
|
||||
$this->assertTrue(!is_object($users));
|
||||
$this->assertTrue( ! is_object($users));
|
||||
$this->assertEqual(count($users), 8);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ class Doctrine_Coverage_Report
|
||||
{
|
||||
$key = $this->path . $fileName;
|
||||
$html = '<div id="coverage">';
|
||||
if (!isset( $this->coverage[$key]))
|
||||
if ( ! isset( $this->coverage[$key]))
|
||||
{
|
||||
echo '<h2>This file has not been tested!</h2>';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user