Mass search and replace for coding standards changes, doc block formatting, and code spacing.
This commit is contained in:
parent
4ce2a36968
commit
27b369a5f3
28
draft/DB.php
28
draft/DB.php
@ -66,18 +66,22 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
const ERR_MANAGER_PARSE = -33;
|
||||
const ERR_LOADMODULE = -34;
|
||||
const ERR_INSUFFICIENT_DATA = -35;
|
||||
|
||||
/**
|
||||
* @var array $instances all the instances of this class
|
||||
*/
|
||||
protected static $instances = array();
|
||||
|
||||
/**
|
||||
* @var array $isConnected whether or not a connection has been established
|
||||
*/
|
||||
protected $isConnected = false;
|
||||
|
||||
/**
|
||||
* @var PDO $dbh the database handler
|
||||
*/
|
||||
protected $dbh;
|
||||
|
||||
/**
|
||||
* @var array $options
|
||||
*/
|
||||
@ -85,11 +89,13 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
'username' => null,
|
||||
'password' => null,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var Doctrine_Db_EventListener_Interface|Doctrine_Overloadable $listener
|
||||
* listener for listening events
|
||||
*/
|
||||
protected $listener;
|
||||
|
||||
/**
|
||||
* @var integer $querySequence
|
||||
*/
|
||||
@ -125,12 +131,14 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
public function nextQuerySequence() {
|
||||
return ++$this->querySequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* getQuerySequence
|
||||
*/
|
||||
public function getQuerySequence() {
|
||||
return $this->querySequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* getDBH
|
||||
*/
|
||||
@ -143,6 +151,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $this->options[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* addListener
|
||||
*
|
||||
@ -157,6 +166,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getListener
|
||||
*
|
||||
@ -165,6 +175,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
public function getListener() {
|
||||
return $this->listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* setListener
|
||||
*
|
||||
@ -209,6 +220,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
public static function getConnection($dsn = null, $username = null, $password = null) {
|
||||
return new self($dsn, $username, $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* driverName
|
||||
* converts a driver name like (oracle) to appropriate PDO
|
||||
@ -223,6 +235,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* parseDSN
|
||||
*
|
||||
@ -301,6 +314,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
public function errorCode() {
|
||||
return $this->dbh->errorCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* errorInfo
|
||||
* Fetch extended error information associated with the last operation on the database handle
|
||||
@ -310,6 +324,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
public function errorInfo() {
|
||||
return $this->dbh->errorInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* prepare
|
||||
*
|
||||
@ -330,6 +345,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* query
|
||||
*
|
||||
@ -355,6 +371,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* quote
|
||||
* quotes a string for use in a query
|
||||
@ -367,6 +384,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $this->dbh->quote($input);
|
||||
}
|
||||
|
||||
/**
|
||||
* exec
|
||||
* executes an SQL statement and returns the number of affected rows
|
||||
@ -389,6 +407,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchAll
|
||||
*
|
||||
@ -418,6 +437,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
public function fetchBoth($statement, array $params = array()) {
|
||||
return $this->query($statement, $params)->fetchAll(PDO::FETCH_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* lastInsertId
|
||||
*
|
||||
@ -428,6 +448,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $this->dbh->lastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
* begins a transaction
|
||||
*
|
||||
@ -444,6 +465,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* commits a transaction
|
||||
*
|
||||
@ -460,6 +482,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* rollBack
|
||||
*
|
||||
@ -476,6 +499,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
$this->listener->onRollback($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* getAttribute
|
||||
* retrieves a database connection attribute
|
||||
@ -488,12 +512,14 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
return $this->dbh->getAttribute($attribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array of available PDO drivers
|
||||
*/
|
||||
public static function getAvailableDrivers() {
|
||||
return PDO::getAvailableDrivers();
|
||||
}
|
||||
|
||||
/**
|
||||
* setAttribute
|
||||
* sets an attribute
|
||||
@ -507,6 +533,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
|
||||
$this->dbh->setAttribute($attribute, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* getIterator
|
||||
*
|
||||
@ -516,6 +543,7 @@ class Doctrine_Db2 implements Countable, IteratorAggregate, Doctrine_Adapter_Int
|
||||
if($this->listener instanceof Doctrine_Db_Profiler)
|
||||
return $this->listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* count
|
||||
* returns the number of executed queries
|
||||
|
@ -9,7 +9,7 @@ function __autoload($classname) {
|
||||
if (class_exists($classname)) {
|
||||
return false;
|
||||
}
|
||||
if (! $path) {
|
||||
if ( ! $path) {
|
||||
$path = dirname(__FILE__);
|
||||
}
|
||||
$classpath = str_replace('Doctrine_', '',$classname);
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node
|
||||
*
|
||||
@ -75,7 +76,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");
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_AdjacencyList
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_AdjacencyList_LevelOrderIterator
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_AdjacencyList_PostOrderIterator
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_AdjacencyList_PreOrderIterator
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_Exception
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_Interface
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_MaterializedPath
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_MaterializedPath_LevelOrderIterator
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_MaterializedPath_PostOrderIterator
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_MaterializedPath_PreOrderIterator
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_NestedSet
|
||||
*
|
||||
@ -461,7 +462,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Accomplishes moving of nodes between different trees.
|
||||
* Used by the move* methods if the root value of the two nodes are different.
|
||||
@ -548,7 +549,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* moves node as prev sibling of dest record
|
||||
*
|
||||
@ -616,7 +617,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
|
||||
$this->updateNode($dest->getNode()->getRightValue(), $this->record['level'] - $oldLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Makes this node a root node. Only used in multiple-root trees.
|
||||
*
|
||||
@ -899,7 +900,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
|
||||
|
||||
$resultRight = $qRight->execute();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gets record's left value
|
||||
*
|
||||
@ -947,7 +948,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
|
||||
*/
|
||||
public function getLevel()
|
||||
{
|
||||
if (!isset($this->level)) {
|
||||
if ( ! isset($this->level)) {
|
||||
$componentName = $this->record->getTable()->getComponentName();
|
||||
$q = $this->_tree->getBaseQuery();
|
||||
$q = $q->where('base.lft < ? AND base.rgt > ?', array($this->getLeftValue(), $this->getRightValue()));
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_NestedSet_LevelOrderIterator
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_NestedSet_PostOrderIterator
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Node_NestedSet_PreOrderIterator
|
||||
*
|
||||
@ -35,26 +36,32 @@ class Doctrine_Node_NestedSet_PreOrderIterator implements Iterator
|
||||
* @var Doctrine_Collection $collection
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
/**
|
||||
* @var array $keys
|
||||
*/
|
||||
protected $keys;
|
||||
|
||||
/**
|
||||
* @var mixed $key
|
||||
*/
|
||||
protected $key;
|
||||
|
||||
/**
|
||||
* @var integer $index
|
||||
*/
|
||||
protected $index;
|
||||
|
||||
/**
|
||||
* @var integer $index
|
||||
*/
|
||||
protected $prevIndex;
|
||||
|
||||
/**
|
||||
* @var integer $index
|
||||
*/
|
||||
protected $traverseLevel;
|
||||
|
||||
/**
|
||||
* @var integer $count
|
||||
*/
|
||||
@ -155,7 +162,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;
|
||||
|
@ -169,6 +169,7 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* parses an EXISTS expression
|
||||
*
|
||||
@ -189,6 +190,7 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition
|
||||
|
||||
return $operator . ' ('.$this->query->createSubquery()->parseQuery($sub, false)->getQuery() . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* getOperator
|
||||
*
|
||||
@ -210,6 +212,7 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition
|
||||
}
|
||||
return $operator;
|
||||
}
|
||||
|
||||
/**
|
||||
* __toString
|
||||
* return string representation of this object
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Table represents a database table
|
||||
* each Doctrine_Table holds the information of foreignKeys and associations
|
||||
@ -36,43 +37,53 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
* @var array $data temporary data which is then loaded into Doctrine_Record::$data
|
||||
*/
|
||||
private $data = array();
|
||||
|
||||
/**
|
||||
* @var array $relations an array containing all the Doctrine_Relation objects for this table
|
||||
*/
|
||||
private $relations = array();
|
||||
|
||||
/**
|
||||
* @var array $primaryKeys an array containing all primary key column names
|
||||
*/
|
||||
private $primaryKeys = array();
|
||||
|
||||
/**
|
||||
* @var mixed $identifier
|
||||
*/
|
||||
private $identifier;
|
||||
|
||||
/**
|
||||
* @see Doctrine_Identifier constants
|
||||
* @var integer $identifierType the type of identifier this table uses
|
||||
*/
|
||||
private $identifierType;
|
||||
|
||||
/**
|
||||
* @var string $query cached simple query
|
||||
*/
|
||||
private $query;
|
||||
|
||||
/**
|
||||
* @var Doctrine_Connection $conn Doctrine_Connection object that created this table
|
||||
*/
|
||||
private $conn;
|
||||
|
||||
/**
|
||||
* @var string $name
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var array $identityMap first level cache
|
||||
*/
|
||||
private $identityMap = array();
|
||||
|
||||
/**
|
||||
* @var Doctrine_Table_Repository $repository record repository
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* @var array $columns an array of column definitions,
|
||||
* keys as column names and values as column definitions
|
||||
@ -90,27 +101,33 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
* )
|
||||
*/
|
||||
protected $columns = array();
|
||||
|
||||
/**
|
||||
* @var array $bound bound relations
|
||||
*/
|
||||
private $bound = array();
|
||||
|
||||
/**
|
||||
* @var array $boundAliases bound relation aliases
|
||||
*/
|
||||
private $boundAliases = array();
|
||||
|
||||
/**
|
||||
* @var integer $columnCount cached column count, Doctrine_Record uses this column count in when
|
||||
* determining its state
|
||||
*/
|
||||
private $columnCount;
|
||||
|
||||
/**
|
||||
* @var array $parents the parent classes of this component
|
||||
*/
|
||||
private $parents = array();
|
||||
|
||||
/**
|
||||
* @var boolean $hasDefaultValues whether or not this table has default values
|
||||
*/
|
||||
private $hasDefaultValues;
|
||||
|
||||
/**
|
||||
* @var array $options an array containing all options
|
||||
*
|
||||
@ -288,6 +305,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
$this->repository = new Doctrine_Table_Repository($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* createQuery
|
||||
* creates a new Doctrine_Query object and adds the component name
|
||||
@ -298,6 +316,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function createQuery() {
|
||||
return Doctrine_Query::create()->from($this->getComponentName());
|
||||
}
|
||||
|
||||
/**
|
||||
* getRepository
|
||||
*
|
||||
@ -330,6 +349,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* setColumn
|
||||
* @param string $name
|
||||
@ -360,6 +380,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
$this->hasDefaultValues = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* hasDefaultValues
|
||||
* returns true if this table has default values, otherwise false
|
||||
@ -369,6 +390,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function hasDefaultValues() {
|
||||
return $this->hasDefaultValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* getDefaultValueOf
|
||||
* returns the default value(if any) for given column
|
||||
@ -387,18 +409,21 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
final public function getIdentifier() {
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
final public function getIdentifierType() {
|
||||
return $this->identifierType;
|
||||
}
|
||||
|
||||
/**
|
||||
* hasColumn
|
||||
* @return boolean
|
||||
@ -406,6 +431,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
final public function hasColumn($name) {
|
||||
return isset($this->columns[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $key
|
||||
* @return void
|
||||
@ -420,6 +446,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns all primary keys
|
||||
* @return array
|
||||
@ -427,12 +454,14 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
final public function getPrimaryKeys() {
|
||||
return $this->primaryKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
final public function hasPrimaryKey($key) {
|
||||
return in_array($key,$this->primaryKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sequence
|
||||
* @return void
|
||||
@ -440,30 +469,35 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
final public function setSequenceName($sequence) {
|
||||
$this->options['sequenceName'] = $sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string sequence name
|
||||
*/
|
||||
final public function getSequenceName() {
|
||||
return $this->options['sequenceName'];
|
||||
}
|
||||
|
||||
/**
|
||||
* getParents
|
||||
*/
|
||||
final public function getParents() {
|
||||
return $this->parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
final public function hasInheritanceMap() {
|
||||
return (empty($this->options['inheritanceMap']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array inheritance map (array keys as fields)
|
||||
*/
|
||||
final public function getInheritanceMap() {
|
||||
return $this->options['inheritanceMap'];
|
||||
}
|
||||
|
||||
/**
|
||||
* return all composite paths in the form [component1].[component2]. . .[componentN]
|
||||
* @return array
|
||||
@ -493,6 +527,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns all bound relations
|
||||
*
|
||||
@ -501,6 +536,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function getBounds() {
|
||||
return $this->bound;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a bound relation array
|
||||
*
|
||||
@ -513,6 +549,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return $this->bound[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a bound relation array
|
||||
*
|
||||
@ -530,6 +567,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
}
|
||||
throw new Doctrine_Table_Exception('Unknown bound '.$name);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the alias for given component name
|
||||
*
|
||||
@ -542,6 +580,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns component name for given alias
|
||||
*
|
||||
@ -554,6 +593,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* unbinds all relations
|
||||
*
|
||||
@ -564,6 +604,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
$this->relations = array();
|
||||
$this->boundAliases = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* unbinds a relation
|
||||
* returns true on success, false on failure
|
||||
@ -585,6 +626,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* binds a relation
|
||||
*
|
||||
@ -608,6 +650,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
$this->bound[$alias] = array($field, $type, $localKey, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* getComponentName
|
||||
* @return string the component name
|
||||
@ -615,12 +658,14 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function getComponentName() {
|
||||
return $this->options['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Doctrine_Connection
|
||||
*/
|
||||
public function getConnection() {
|
||||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* hasRelatedComponent
|
||||
* @return boolean
|
||||
@ -628,6 +673,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
final public function hasRelatedComponent($name, $component) {
|
||||
return (strpos($this->bound[$name][0], $component.'.') !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name component name of which a foreign key object is bound
|
||||
* @return boolean
|
||||
@ -643,6 +689,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getRelation
|
||||
*
|
||||
@ -749,6 +796,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
throw new Doctrine_Table_Exception($this->options['name'] . " doesn't have a relation to " . $original);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array containing all foreign key objects
|
||||
*
|
||||
@ -762,6 +810,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return $this->relations;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the database table name
|
||||
*
|
||||
@ -780,6 +829,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
final public function getTableName() {
|
||||
return $this->options['tableName'];
|
||||
}
|
||||
|
||||
/**
|
||||
* create
|
||||
* creates a new record
|
||||
@ -793,6 +843,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
$this->data = array();
|
||||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* finds a record by its identifier
|
||||
*
|
||||
@ -823,6 +874,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* applyInheritance
|
||||
* @param $where query where part to be modified
|
||||
@ -839,6 +891,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* findAll
|
||||
* returns a collection of records
|
||||
@ -850,6 +903,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
$users = $graph->query("FROM ".$this->options['name']);
|
||||
return $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* findByDql
|
||||
* finds records with given DQL where clause
|
||||
@ -868,6 +922,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function findByDql($dql, array $params = array()) {
|
||||
return $this->findBySql($dql, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear
|
||||
* clears the first level cache (identityMap)
|
||||
@ -877,6 +932,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function clear() {
|
||||
$this->identityMap = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* getRecord
|
||||
* first checks if record exists in identityMap, if not
|
||||
@ -911,6 +967,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id database row id
|
||||
* @throws Doctrine_Find_Exception
|
||||
@ -929,6 +986,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
}
|
||||
return $this->getRecord();
|
||||
}
|
||||
|
||||
/**
|
||||
* count
|
||||
*
|
||||
@ -938,6 +996,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
$a = $this->conn->getDBH()->query("SELECT COUNT(1) FROM ".$this->options['tableName'])->fetch(PDO::FETCH_NUM);
|
||||
return current($a);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Doctrine_Query a Doctrine_Query object
|
||||
*/
|
||||
@ -946,6 +1005,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
$graph->load($this->getComponentName());
|
||||
return $graph;
|
||||
}
|
||||
|
||||
/**
|
||||
* execute
|
||||
* @param string $query
|
||||
@ -972,6 +1032,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
}
|
||||
return $coll;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets enumerated value array for given field
|
||||
*
|
||||
@ -982,6 +1043,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
final public function setEnumValues($field, array $values) {
|
||||
$this->options['enumMap'][strtolower($field)] = $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @return array
|
||||
@ -992,6 +1054,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
else
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* enumValue
|
||||
*
|
||||
@ -1005,6 +1068,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return isset($this->options['enumMap'][$field][$index]) ? $this->options['enumMap'][$field][$index] : $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* invokeSet
|
||||
*
|
||||
@ -1015,7 +1079,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
return $value;
|
||||
|
||||
$prefix = $this->getAttribute(Doctrine::ATTR_ACCESSOR_PREFIX_SET);
|
||||
if (!$prefix)
|
||||
if ( ! $prefix)
|
||||
$prefix = 'set';
|
||||
|
||||
$method = $prefix . $name;
|
||||
@ -1026,6 +1090,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* invokeGet
|
||||
*
|
||||
@ -1036,7 +1101,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
return $value;
|
||||
|
||||
$prefix = $this->getAttribute(Doctrine::ATTR_ACCESSOR_PREFIX_GET);
|
||||
if (!$prefix)
|
||||
if ( ! $prefix)
|
||||
$prefix = 'get';
|
||||
|
||||
$method = $prefix . $name;
|
||||
@ -1047,6 +1112,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* enumIndex
|
||||
*
|
||||
@ -1062,6 +1128,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return array_search($value, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* getDefinitionOf
|
||||
*
|
||||
@ -1073,6 +1140,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getColumnCount
|
||||
*
|
||||
@ -1090,6 +1158,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
final public function getColumns() {
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array containing all the column names
|
||||
*
|
||||
@ -1098,6 +1167,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function getColumnNames() {
|
||||
return array_keys($this->columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* getDefinitionOf
|
||||
*
|
||||
@ -1109,6 +1179,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTypeOf
|
||||
*
|
||||
@ -1120,6 +1191,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* setData
|
||||
* doctrine uses this function internally
|
||||
@ -1131,6 +1203,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function setData(array $data) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the maximum primary key value
|
||||
*
|
||||
@ -1142,6 +1215,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
$data = $stmt->fetch(PDO::FETCH_NUM);
|
||||
return isset($data[0])?$data[0]:1;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns simple cached query
|
||||
*
|
||||
@ -1150,6 +1224,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
final public function getQuery() {
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns internal data, used by Doctrine_Record instances
|
||||
* when retrieving data from database
|
||||
@ -1159,6 +1234,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
final public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a string representation of this object
|
||||
*
|
||||
@ -1167,6 +1243,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function __toString() {
|
||||
return Doctrine_Lib::getTableAsString($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a string representation of this object
|
||||
*
|
||||
@ -1181,6 +1258,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
// set the table definition for the given tree implementation
|
||||
$this->_tree->setTableDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
* getter for associated tree
|
||||
*
|
||||
@ -1189,6 +1267,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function getTree() {
|
||||
return isset($this->_treeImplName) ? $this->_tree : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* determine if table acts as tree
|
||||
*
|
||||
@ -1197,6 +1276,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function isTree() {
|
||||
return !is_null($this->_treeImplName) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter for tree implementation name
|
||||
*
|
||||
@ -1205,6 +1285,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
||||
public function getTreeImplName() {
|
||||
return $this->_treeImplName;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter for tree options
|
||||
*
|
||||
|
@ -83,7 +83,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);
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Tree_AdjacencyList
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Tree_Exception
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Tree_Interface
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Tree_MaterializedPath
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Tree_NestedSet
|
||||
*
|
||||
@ -32,7 +33,7 @@
|
||||
class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Interface
|
||||
{
|
||||
private $_baseQuery;
|
||||
|
||||
|
||||
/**
|
||||
* constructor, creates tree with reference to table and sets default root options
|
||||
*
|
||||
@ -48,7 +49,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
|
||||
|
||||
parent::__construct($table, $options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* used to define table attributes required for the NestetSet implementation
|
||||
* adds lft and rgt columns for corresponding left and right values
|
||||
@ -99,7 +100,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
|
||||
{
|
||||
return $this->fetchRoot($rootId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches a/the root node.
|
||||
*
|
||||
@ -254,7 +255,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
@ -263,12 +264,12 @@ 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 clone $this->_baseQuery;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
@ -279,7 +280,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
|
||||
$q->select("base.*")->from($this->table->getComponentName() . " base");
|
||||
return $q;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
@ -293,7 +294,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
|
||||
}
|
||||
$this->_baseQuery = $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
@ -302,7 +303,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
|
||||
{
|
||||
$this->_baseQuery = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
|
@ -37,25 +37,30 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
* @var $dbh the database handler
|
||||
*/
|
||||
protected $dbh;
|
||||
|
||||
/**
|
||||
* @var array $tables an array containing all the initialized Doctrine_Table objects
|
||||
* keys representing Doctrine_Table component names and values as Doctrine_Table objects
|
||||
*/
|
||||
protected $tables = array();
|
||||
|
||||
/**
|
||||
* @var array $exported
|
||||
*/
|
||||
protected $exported = array();
|
||||
|
||||
/**
|
||||
* @var string $driverName the name of this connection driver
|
||||
*/
|
||||
protected $driverName;
|
||||
|
||||
/**
|
||||
* @var array $supported an array containing all features this driver supports,
|
||||
* keys representing feature names and values as
|
||||
* one of the following (true, false, 'emulated')
|
||||
*/
|
||||
protected $supported = array();
|
||||
|
||||
/**
|
||||
* @var array $modules an array containing all modules
|
||||
* transaction Doctrine_Transaction driver, handles savepoint and transaction isolation abstraction
|
||||
@ -85,6 +90,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
'sequence' => false,
|
||||
'unitOfWork' => false,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $properties an array of connection properties
|
||||
*/
|
||||
@ -103,10 +109,12 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
'wildcards' => array('%', '_'),
|
||||
'varchar_max_length' => 255,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $serverInfo
|
||||
*/
|
||||
protected $serverInfo = array();
|
||||
|
||||
/**
|
||||
* @var array $availableDrivers an array containing all availible drivers
|
||||
*/
|
||||
@ -143,6 +151,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->getAttribute(Doctrine::ATTR_LISTENER)->onOpen($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* getName
|
||||
* returns the name of this driver
|
||||
@ -153,6 +162,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->driverName;
|
||||
}
|
||||
|
||||
/**
|
||||
* __get
|
||||
* lazy loads given module and returns it
|
||||
@ -187,6 +197,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $this->modules[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Quotes pattern (% and _) characters in a string)
|
||||
*
|
||||
@ -209,6 +220,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* convertBoolean
|
||||
* some drivers need the boolean values to be converted into integers
|
||||
@ -232,6 +244,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote a string so it can be safely used as a table or column name
|
||||
*
|
||||
@ -276,6 +289,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
return $this->properties['identifier_quoting']['start']
|
||||
. $str . $this->properties['identifier_quoting']['end'];
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the manager that created this connection
|
||||
*
|
||||
@ -285,6 +299,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->getParent();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the database handler of which this connection uses
|
||||
*
|
||||
@ -294,6 +309,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->dbh;
|
||||
}
|
||||
|
||||
/**
|
||||
* converts given driver name
|
||||
*
|
||||
@ -302,6 +318,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
public function driverName($name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* supports
|
||||
*
|
||||
@ -316,6 +333,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* quote
|
||||
* quotes given input parameter
|
||||
@ -351,6 +369,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
return $this->dbh->quote($input);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes any formatting in an sequence name using the 'seqname_format' option
|
||||
*
|
||||
@ -367,6 +386,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $sqn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes any formatting in an index name using the 'idxname_format' option
|
||||
*
|
||||
@ -382,6 +402,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* adds sequence name formatting to a sequence name
|
||||
*
|
||||
@ -393,6 +414,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
return sprintf($this->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT),
|
||||
preg_replace('/[^a-z0-9_\$.]/i', '_', $sqn));
|
||||
}
|
||||
|
||||
/**
|
||||
* adds index name formatting to a index name
|
||||
*
|
||||
@ -471,6 +493,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a table row with specified data.
|
||||
*
|
||||
@ -495,6 +518,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charset on the current connection
|
||||
*
|
||||
@ -506,6 +530,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the date/time format for the current connection
|
||||
*
|
||||
@ -516,6 +541,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
public function setDateFormat($format = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchAll
|
||||
*
|
||||
@ -527,6 +553,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchOne
|
||||
*
|
||||
@ -539,6 +566,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchColumn($colnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchRow
|
||||
*
|
||||
@ -550,6 +578,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchArray
|
||||
*
|
||||
@ -561,6 +590,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetch(PDO::FETCH_NUM);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchColumn
|
||||
*
|
||||
@ -573,6 +603,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchAll(PDO::FETCH_COLUMN, $colnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchAssoc
|
||||
*
|
||||
@ -584,6 +615,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchBoth
|
||||
*
|
||||
@ -595,6 +627,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchAll(PDO::FETCH_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* query
|
||||
* queries the database using Doctrine Query Language
|
||||
@ -617,6 +650,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $parser->query($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* query
|
||||
* queries the database using Doctrine Query Language and returns
|
||||
@ -646,6 +680,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $coll[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* queries the database with limit and offset
|
||||
* added to the query and returns a PDOStatement object
|
||||
@ -662,6 +697,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $this->dbh->query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* standaloneQuery
|
||||
*
|
||||
@ -674,6 +710,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* execute
|
||||
* @param string $query sql query
|
||||
@ -696,6 +733,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->rethrowException($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* exec
|
||||
* @param string $query sql query
|
||||
@ -717,6 +755,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->rethrowException($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* rethrowException
|
||||
*
|
||||
@ -734,6 +773,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
throw $exc;
|
||||
}
|
||||
|
||||
/**
|
||||
* hasTable
|
||||
* whether or not this connection has table $name initialized
|
||||
@ -745,6 +785,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return isset($this->tables[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a table object for given component name
|
||||
*
|
||||
@ -816,6 +857,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array of all initialized tables
|
||||
*
|
||||
@ -825,6 +867,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->tables;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an iterator that iterators through all
|
||||
* initialized table objects
|
||||
@ -841,6 +884,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return new ArrayIterator($this->tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the count of initialized table objects
|
||||
*
|
||||
@ -850,6 +894,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return count($this->tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* addTable
|
||||
* adds a Doctrine_Table object into connection registry
|
||||
@ -867,6 +912,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
$this->tables[$name] = $objTable;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* create
|
||||
* creates a record
|
||||
@ -879,6 +925,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->getTable($name)->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* flush
|
||||
* saves all the records from all tables
|
||||
@ -893,6 +940,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
$this->unitOfWork->saveAll();
|
||||
$this->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* clear
|
||||
* clears all repositories
|
||||
@ -906,6 +954,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
$table->clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* evictTables
|
||||
* evicts all tables
|
||||
@ -917,6 +966,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
$this->tables = array();
|
||||
$this->exported = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* close
|
||||
* closes the connection
|
||||
@ -931,6 +981,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->getAttribute(Doctrine::ATTR_LISTENER)->onClose($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current transaction nesting level
|
||||
*
|
||||
@ -940,6 +991,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->transaction->getTransactionLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* beginTransaction
|
||||
* starts a new transaction
|
||||
@ -953,6 +1005,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
$this->transaction->beginTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* commits the current transaction
|
||||
* if lockmode is optimistic this method starts a transaction
|
||||
@ -964,6 +1017,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
$this->transaction->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* rollback
|
||||
* rolls back all transactions
|
||||
@ -977,6 +1031,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
$this->transaction->rollback();
|
||||
}
|
||||
|
||||
/**
|
||||
* saves the given record
|
||||
*
|
||||
@ -1003,6 +1058,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onSave($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes this data access object and all the related composites
|
||||
* this operation is isolated by a transaction
|
||||
@ -1030,6 +1086,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a string representation of this object
|
||||
* @return string
|
||||
|
@ -42,18 +42,22 @@ class Doctrine_Hydrate implements Serializable
|
||||
* constant for SELECT queries
|
||||
*/
|
||||
const SELECT = 0;
|
||||
|
||||
/**
|
||||
* constant for DELETE queries
|
||||
*/
|
||||
const DELETE = 1;
|
||||
|
||||
/**
|
||||
* constant for UPDATE queries
|
||||
*/
|
||||
const UPDATE = 2;
|
||||
|
||||
/**
|
||||
* constant for INSERT queries
|
||||
*/
|
||||
const INSERT = 3;
|
||||
|
||||
/**
|
||||
* constant for CREATE queries
|
||||
*/
|
||||
@ -63,15 +67,18 @@ class Doctrine_Hydrate implements Serializable
|
||||
* @var array $params query input parameters
|
||||
*/
|
||||
protected $_params = array();
|
||||
|
||||
/**
|
||||
* @var Doctrine_Connection $conn Doctrine_Connection object
|
||||
*/
|
||||
protected $_conn;
|
||||
|
||||
/**
|
||||
* @var Doctrine_View $_view Doctrine_View object, when set this object will use the
|
||||
* the query given by the view object for object population
|
||||
*/
|
||||
protected $_view;
|
||||
|
||||
/**
|
||||
* @var array $_aliasMap two dimensional array containing the map for query aliases
|
||||
* Main keys are component aliases
|
||||
@ -85,15 +92,18 @@ class Doctrine_Hydrate implements Serializable
|
||||
* agg the aggregates of this component
|
||||
*/
|
||||
protected $_aliasMap = array();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected $pendingAggregates = array();
|
||||
|
||||
/**
|
||||
* @var array $aggregateMap an array containing all aggregate aliases, keys as dql aliases
|
||||
* and values as sql aliases
|
||||
*/
|
||||
protected $aggregateMap = array();
|
||||
|
||||
/**
|
||||
* @var array $_options an array of options
|
||||
*/
|
||||
@ -102,6 +112,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
'parserCache' => false,
|
||||
'resultSetCache' => false,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $parts SQL query string parts
|
||||
*/
|
||||
@ -119,6 +130,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
'limit' => false,
|
||||
'offset' => false,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var integer $type the query type
|
||||
*
|
||||
@ -129,12 +141,14 @@ class Doctrine_Hydrate implements Serializable
|
||||
protected $_cache;
|
||||
|
||||
protected $_tableAliases = array();
|
||||
|
||||
/**
|
||||
* @var array $_tableAliasSeeds A simple array keys representing table aliases and values
|
||||
* as table alias seeds. The seeds are used for generating short table
|
||||
* aliases.
|
||||
*/
|
||||
protected $_tableAliasSeeds = array();
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
@ -160,6 +174,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return $this->_cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* serialize
|
||||
* this method is automatically called when this Doctrine_Hydrate is serialized
|
||||
@ -171,6 +186,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
$vars = get_object_vars($this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* unseralize
|
||||
* this method is automatically called everytime a Doctrine_Hydrate object is unserialized
|
||||
@ -182,6 +198,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* generateNewTableAlias
|
||||
* generates a new alias from given table alias
|
||||
@ -207,6 +224,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* hasTableAlias
|
||||
* whether or not this object has given tableAlias
|
||||
@ -218,6 +236,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return (isset($this->_tableAliases[$tableAlias]));
|
||||
}
|
||||
|
||||
/**
|
||||
* getComponentAlias
|
||||
* get component alias associated with given table alias
|
||||
@ -232,6 +251,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
}
|
||||
return $this->_tableAliases[$tableAlias];
|
||||
}
|
||||
|
||||
/**
|
||||
* getTableAliasSeed
|
||||
* returns the alias seed for given table alias
|
||||
@ -246,6 +266,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
}
|
||||
return $this->_tableAliasSeeds[$tableAlias];
|
||||
}
|
||||
|
||||
/**
|
||||
* generateTableAlias
|
||||
* generates a table alias from given table name and associates
|
||||
@ -272,6 +293,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTableAliases
|
||||
* returns all table aliases
|
||||
@ -282,6 +304,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return $this->_tableAliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* addTableAlias
|
||||
* adds an alias for table and associates it with given component alias
|
||||
@ -296,6 +319,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTableAlias
|
||||
* some database such as Oracle need the identifier lengths to be < ~30 chars
|
||||
@ -322,6 +346,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $this->generateTableAlias($componentAlias, $tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* addQueryPart
|
||||
* adds a query part in the query part array
|
||||
@ -340,6 +365,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* setQueryPart
|
||||
* sets a query part in the query part array
|
||||
@ -357,6 +383,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $this->parts[$part];
|
||||
}
|
||||
|
||||
/**
|
||||
* removeQueryPart
|
||||
* removes a query part from the query part array
|
||||
@ -378,6 +405,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* setQueryPart
|
||||
* sets a query part in the query part array
|
||||
@ -401,6 +429,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getAliasDeclaration
|
||||
* get the declaration for given component alias
|
||||
@ -416,6 +445,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $this->_aliasMap[$componentAlias];
|
||||
}
|
||||
|
||||
/**
|
||||
* copyAliases
|
||||
* copy aliases from another Hydrate object
|
||||
@ -433,6 +463,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* createSubquery
|
||||
* creates a subquery
|
||||
@ -452,6 +483,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* limitSubqueryUsed
|
||||
* whether or not limit subquery was used
|
||||
@ -462,6 +494,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* clear
|
||||
* resets all the variables
|
||||
@ -486,6 +519,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
);
|
||||
$this->inheritanceApplied = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getConnection
|
||||
*
|
||||
@ -495,6 +529,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return $this->_conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* setView
|
||||
* sets a database view this query object uses
|
||||
@ -507,6 +542,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
$this->_view = $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* getView
|
||||
* returns the view associated with this query object (if any)
|
||||
@ -517,6 +553,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return $this->_view;
|
||||
}
|
||||
|
||||
/**
|
||||
* getParams
|
||||
*
|
||||
@ -526,6 +563,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return $this->_params;
|
||||
}
|
||||
|
||||
/**
|
||||
* setParams
|
||||
*
|
||||
@ -538,6 +576,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* setAliasMap
|
||||
* sets the whole component alias map
|
||||
@ -551,6 +590,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getAliasMap
|
||||
* returns the component alias map
|
||||
@ -561,6 +601,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return $this->_aliasMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* mapAggregateValues
|
||||
* map the aggregate values of given dataset row to a given record
|
||||
@ -634,6 +675,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
$stmt = $this->_conn->execute($query, $params);
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* execute
|
||||
* executes the query and populates the data set
|
||||
@ -705,6 +747,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* applyInheritance
|
||||
* applies column aggregation inheritance to DQL / SQL query
|
||||
@ -762,6 +805,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* parseData
|
||||
* parses the data returned by statement object
|
||||
@ -999,6 +1043,7 @@ class Doctrine_Hydrate implements Serializable
|
||||
$stmt->closeCursor();
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string returns a string representation of this object
|
||||
*/
|
||||
|
@ -42,6 +42,7 @@ class Doctrine_Query
|
||||
{
|
||||
return new Doctrine_Query();
|
||||
}
|
||||
|
||||
/**
|
||||
* addSelect
|
||||
* adds fields to the SELECT part of the query
|
||||
@ -53,6 +54,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('select')->parse($select, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* addWhere
|
||||
* adds conditions to the WHERE part of the query
|
||||
@ -70,6 +72,7 @@ class Doctrine_Query
|
||||
}
|
||||
return $this->getParser('where')->parse($where, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* addGroupBy
|
||||
* adds fields to the GROUP BY part of the query
|
||||
@ -81,6 +84,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('groupby')->parse($groupby, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* addHaving
|
||||
* adds conditions to the HAVING part of the query
|
||||
@ -92,6 +96,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('having')->parse($having, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* addOrderBy
|
||||
* adds fields to the ORDER BY part of the query
|
||||
@ -103,6 +108,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('orderby')->parse($orderby, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* select
|
||||
* sets the SELECT part of the query
|
||||
@ -114,6 +120,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('from')->parse($select);
|
||||
}
|
||||
|
||||
/**
|
||||
* from
|
||||
* sets the FROM part of the query
|
||||
@ -125,6 +132,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('from')->parse($from);
|
||||
}
|
||||
|
||||
/**
|
||||
* innerJoin
|
||||
* appends an INNER JOIN to the FROM part of the query
|
||||
@ -136,6 +144,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('from')->parse('INNER JOIN ' . $join);
|
||||
}
|
||||
|
||||
/**
|
||||
* leftJoin
|
||||
* appends a LEFT JOIN to the FROM part of the query
|
||||
@ -147,6 +156,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('from')->parse('LERT JOIN ' . $join);
|
||||
}
|
||||
|
||||
/**
|
||||
* groupBy
|
||||
* sets the GROUP BY part of the query
|
||||
@ -158,6 +168,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('groupby')->parse($groupby);
|
||||
}
|
||||
|
||||
/**
|
||||
* where
|
||||
* sets the WHERE part of the query
|
||||
@ -175,6 +186,7 @@ class Doctrine_Query
|
||||
}
|
||||
return $this->getParser('where')->parse($where);
|
||||
}
|
||||
|
||||
/**
|
||||
* having
|
||||
* sets the HAVING part of the query
|
||||
@ -192,6 +204,7 @@ class Doctrine_Query
|
||||
}
|
||||
return $this->getParser('having')->parse($having);
|
||||
}
|
||||
|
||||
/**
|
||||
* orderBy
|
||||
* sets the ORDER BY part of the query
|
||||
@ -203,6 +216,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('orderby')->parse($dql);
|
||||
}
|
||||
|
||||
/**
|
||||
* limit
|
||||
* sets the DQL query limit
|
||||
@ -214,6 +228,7 @@ class Doctrine_Query
|
||||
{
|
||||
return $this->getParser('limit')->parse($dql);
|
||||
}
|
||||
|
||||
/**
|
||||
* offset
|
||||
* sets the DQL query offset
|
||||
|
@ -36,6 +36,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate
|
||||
* @var array $fields
|
||||
*/
|
||||
private $fields;
|
||||
|
||||
/**
|
||||
* __call
|
||||
* method overloader
|
||||
@ -59,6 +60,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
*/
|
||||
@ -69,6 +71,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate
|
||||
}
|
||||
return $this->parts[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* parseQuery
|
||||
*
|
||||
@ -126,6 +129,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getQuery
|
||||
*
|
||||
@ -191,6 +195,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate
|
||||
}
|
||||
return $q;
|
||||
}
|
||||
|
||||
/**
|
||||
* getFields
|
||||
*
|
||||
@ -200,6 +205,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate
|
||||
{
|
||||
return $this->fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* addComponent
|
||||
*
|
||||
|
@ -42,33 +42,39 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
* a Doctrine_Record is in dirty state when its properties are changed
|
||||
*/
|
||||
const STATE_DIRTY = 1;
|
||||
|
||||
/**
|
||||
* TDIRTY STATE
|
||||
* a Doctrine_Record is in transient dirty state when it is created and some of its fields are modified
|
||||
* but it is NOT yet persisted into database
|
||||
*/
|
||||
const STATE_TDIRTY = 2;
|
||||
|
||||
/**
|
||||
* CLEAN STATE
|
||||
* a Doctrine_Record is in clean state when all of its properties are loaded from the database
|
||||
* and none of its properties are changed
|
||||
*/
|
||||
const STATE_CLEAN = 3;
|
||||
|
||||
/**
|
||||
* PROXY STATE
|
||||
* a Doctrine_Record is in proxy state when its properties are not fully loaded
|
||||
*/
|
||||
const STATE_PROXY = 4;
|
||||
|
||||
/**
|
||||
* NEW TCLEAN
|
||||
* a Doctrine_Record is in transient clean state when it is created and none of its fields are modified
|
||||
*/
|
||||
const STATE_TCLEAN = 5;
|
||||
|
||||
/**
|
||||
* DELETED STATE
|
||||
* a Doctrine_Record turns into deleted state when it is deleted
|
||||
*/
|
||||
const STATE_DELETED = 6;
|
||||
|
||||
/**
|
||||
* the following protected variables use '_' prefixes, the reason for this is to allow child
|
||||
* classes call for example $this->id, $this->state for getting the values of columns named 'id' and 'state'
|
||||
@ -78,48 +84,59 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
* @var object Doctrine_Table $_table the factory that created this data access object
|
||||
*/
|
||||
protected $_table;
|
||||
|
||||
/**
|
||||
* @var Doctrine_Node_<TreeImpl> node object
|
||||
*/
|
||||
protected $_node;
|
||||
|
||||
/**
|
||||
* @var integer $_id the primary keys of this object
|
||||
*/
|
||||
protected $_id = array();
|
||||
|
||||
/**
|
||||
* @var array $_data the record data
|
||||
*/
|
||||
protected $_data = array();
|
||||
|
||||
/**
|
||||
* @var array $_values the values array, aggregate values and such are mapped into this array
|
||||
*/
|
||||
protected $_values = array();
|
||||
|
||||
/**
|
||||
* @var integer $_state the state of this record
|
||||
* @see STATE_* constants
|
||||
*/
|
||||
protected $_state;
|
||||
|
||||
/**
|
||||
* @var array $_modified an array containing properties that have been modified
|
||||
*/
|
||||
protected $_modified = array();
|
||||
|
||||
/**
|
||||
* @var Doctrine_Validator_ErrorStack error stack object
|
||||
*/
|
||||
protected $_errorStack;
|
||||
|
||||
/**
|
||||
* @var array $references an array containing all the references
|
||||
*/
|
||||
private $references = array();
|
||||
|
||||
/**
|
||||
* @var integer $index this index is used for creating object identifiers
|
||||
*/
|
||||
private static $index = 1;
|
||||
|
||||
/**
|
||||
* @var Doctrine_Null $null a Doctrine_Null object used for extremely fast
|
||||
* null value testing
|
||||
*/
|
||||
private static $null;
|
||||
|
||||
/**
|
||||
* @var integer $oid object identifier, each Record object has a unique object identifier
|
||||
*/
|
||||
@ -211,6 +228,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
$this->construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* initNullObject
|
||||
*
|
||||
@ -221,6 +239,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
self::$null = $null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Doctrine_Null
|
||||
*/
|
||||
@ -228,6 +247,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return self::$null;
|
||||
}
|
||||
|
||||
/**
|
||||
* setUp
|
||||
* this method is used for setting up relations and attributes
|
||||
@ -256,6 +276,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this->oid;
|
||||
}
|
||||
|
||||
/**
|
||||
* isValid
|
||||
*
|
||||
@ -281,6 +302,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return $this->_errorStack->count() == 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Emtpy template method to provide concrete Record classes with the possibility
|
||||
* to hook into the validation procedure, doing any custom / specialized
|
||||
@ -311,6 +333,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this->_errorStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* errorStack
|
||||
* assigns / returns record errorStack
|
||||
@ -329,6 +352,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
return $this->_errorStack;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setDefaultValues
|
||||
* sets the default values for records internal data
|
||||
@ -354,6 +378,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* cleanData
|
||||
* this method does several things to records internal data
|
||||
@ -429,6 +454,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* hydrate
|
||||
* hydrates this object from given array
|
||||
@ -444,6 +470,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
$this->cleanData();
|
||||
$this->prepareIdentifiers();
|
||||
}
|
||||
|
||||
/**
|
||||
* prepareIdentifiers
|
||||
* prepares identifiers for later use
|
||||
@ -488,6 +515,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* serialize
|
||||
* this method is automatically called when this Doctrine_Record is serialized
|
||||
@ -525,6 +553,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return serialize($vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* unseralize
|
||||
* this method is automatically called everytime a Doctrine_Record object is unserialized
|
||||
@ -557,6 +586,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
$this->_table->getAttribute(Doctrine::ATTR_LISTENER)->onWakeUp($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* getState
|
||||
* returns the current state of the object
|
||||
@ -568,6 +598,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this->_state;
|
||||
}
|
||||
|
||||
/**
|
||||
* state
|
||||
* returns / assigns the state of this record
|
||||
@ -611,6 +642,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
throw new Doctrine_Record_State_Exception('Unknown record state ' . $state);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* refresh
|
||||
* refresh internal data from the database
|
||||
@ -651,6 +683,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* factoryRefresh
|
||||
* refreshes the data from outer source (Doctrine_Table)
|
||||
@ -676,6 +709,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
$this->_table->getAttribute(Doctrine::ATTR_LISTENER)->onLoad($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* getTable
|
||||
* returns the table object for this record
|
||||
@ -686,6 +720,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* getData
|
||||
* return all the internal data
|
||||
@ -696,6 +731,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* rawGet
|
||||
* returns the value of a property, if the property is not yet loaded
|
||||
@ -715,6 +751,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return $this->_data[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* load
|
||||
* loads all the unitialized properties from the database
|
||||
@ -733,6 +770,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
* returns a value of a property or a related component
|
||||
@ -793,6 +831,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return $this->references[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* mapValue
|
||||
* This simple method is used for mapping values to $values property.
|
||||
@ -808,6 +847,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
$name = strtolower($name);
|
||||
$this->_values[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* set
|
||||
* method for altering properties and Doctrine_Record references
|
||||
@ -905,6 +945,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
$this->references[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* contains
|
||||
*
|
||||
@ -926,6 +967,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return void
|
||||
@ -937,6 +979,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
// todo: what to do with references ?
|
||||
}
|
||||
|
||||
/**
|
||||
* applies the changes made to this object into database
|
||||
* this method is smart enough to know if any changes are made
|
||||
@ -979,6 +1022,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
$conn->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to save the object and all its related components.
|
||||
* In contrast to Doctrine_Record::save(), this method does not
|
||||
@ -996,6 +1040,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* replace
|
||||
* Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
|
||||
@ -1022,6 +1067,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return $conn->replace($this->_table->getTableName(), $this->getPrepared(), $this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array of modified fields and associated values
|
||||
* @return array
|
||||
@ -1035,6 +1081,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* getPrepared
|
||||
*
|
||||
@ -1091,6 +1138,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* count
|
||||
* this class implements countable interface
|
||||
@ -1101,6 +1149,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return count($this->_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* alias for count()
|
||||
*
|
||||
@ -1110,6 +1159,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* toArray
|
||||
* returns the record as an array
|
||||
@ -1129,6 +1179,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* exists
|
||||
* returns true if this record is persistent, otherwise false
|
||||
@ -1140,6 +1191,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
return ($this->_state !== Doctrine_Record::STATE_TCLEAN &&
|
||||
$this->_state !== Doctrine_Record::STATE_TDIRTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* method for checking existence of properties and Doctrine_Record references
|
||||
* @param mixed $name name of the property or reference
|
||||
@ -1152,6 +1204,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return $this->_table->hasRelation($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* getIterator
|
||||
* @return Doctrine_Record_Iterator a Doctrine_Record_Iterator that iterates through the data
|
||||
@ -1160,6 +1213,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return new Doctrine_Record_Iterator($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes this data access object and all the related composites
|
||||
* this operation is isolated by a transaction
|
||||
@ -1175,6 +1229,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return $conn->delete($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* copy
|
||||
* returns a copy of this object
|
||||
@ -1192,6 +1247,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* copyDeep
|
||||
* returns a copy of this object and all its related objects
|
||||
@ -1212,7 +1268,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return $copy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* assignIdentifier
|
||||
*
|
||||
@ -1238,6 +1294,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
$this->_modified = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the primary keys of this object
|
||||
*
|
||||
@ -1247,6 +1304,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the value of autoincremented primary key of this object (if any)
|
||||
*
|
||||
@ -1260,6 +1318,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* getLast
|
||||
* this method is used internally be Doctrine_Query
|
||||
@ -1272,6 +1331,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* hasRefence
|
||||
* @param string $name
|
||||
@ -1281,6 +1341,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return isset($this->references[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* obtainReference
|
||||
*
|
||||
@ -1294,6 +1355,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
throw new Doctrine_Record_Exception("Unknown reference $name");
|
||||
}
|
||||
|
||||
/**
|
||||
* initalizes a one-to-many / many-to-many relation
|
||||
*
|
||||
@ -1319,6 +1381,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getReferences
|
||||
* @return array all references
|
||||
@ -1327,6 +1390,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this->references;
|
||||
}
|
||||
|
||||
/**
|
||||
* loadReference
|
||||
* loads a related component
|
||||
@ -1348,6 +1412,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
$this->references[$name] = $coll;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* binds One-to-One composite relation
|
||||
*
|
||||
@ -1359,6 +1424,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
$this->_table->bind($componentName, $foreignKey, Doctrine_Relation::ONE_COMPOSITE, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* binds One-to-Many composite relation
|
||||
*
|
||||
@ -1370,6 +1436,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
$this->_table->bind($componentName, $foreignKey, Doctrine_Relation::MANY_COMPOSITE, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* binds One-to-One aggregate relation
|
||||
*
|
||||
@ -1381,6 +1448,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
$this->_table->bind($componentName, $foreignKey, Doctrine_Relation::ONE_AGGREGATE, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* binds One-to-Many aggregate relation
|
||||
*
|
||||
@ -1392,6 +1460,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
$this->_table->bind($componentName, $foreignKey, Doctrine_Relation::MANY_AGGREGATE, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* hasColumn
|
||||
* sets a column definition
|
||||
@ -1406,6 +1475,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
$this->_table->setColumn($name, $type, $length, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* countRelated
|
||||
*
|
||||
@ -1422,6 +1492,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
$array = $query->execute(array($this->getIncremented()));
|
||||
return $array[0]['COUNT(1)'];
|
||||
}
|
||||
|
||||
/**
|
||||
* merge
|
||||
* merges this record with an array of values
|
||||
@ -1457,6 +1528,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
$this->_table->setEnumValues($column, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* attribute
|
||||
* sets or retrieves an option
|
||||
@ -1480,6 +1552,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
$this->_table->setAttribute($attr, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* option
|
||||
* sets or retrieves an option
|
||||
@ -1503,6 +1576,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
$this->_table->setOption($name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* index
|
||||
* defines or retrieves an index
|
||||
@ -1521,6 +1595,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
return $this->_table->addIndex($name, $definition);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* addListener
|
||||
*
|
||||
@ -1532,6 +1607,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
$this->_table->addListener($listener, $name = null);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getListener
|
||||
*
|
||||
@ -1541,6 +1617,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
{
|
||||
return $this->_table->getListener();
|
||||
}
|
||||
|
||||
/**
|
||||
* setListener
|
||||
*
|
||||
@ -1552,6 +1629,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
$this->_table->setListener($listener);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* call
|
||||
*
|
||||
@ -1575,6 +1653,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter for node assciated with this record
|
||||
*
|
||||
@ -1595,6 +1674,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
|
||||
return $this->_node;
|
||||
}
|
||||
|
||||
/**
|
||||
* used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE
|
||||
*
|
||||
@ -1602,6 +1682,7 @@ abstract class Doctrine_Record2 extends Doctrine_Access implements Countable, It
|
||||
public function deleteNode() {
|
||||
$this->getNode()->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a string representation of this object
|
||||
*/
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Table
|
||||
*
|
||||
@ -39,39 +40,48 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
* @var array $data temporary data which is then loaded into Doctrine_Record::$data
|
||||
*/
|
||||
private $data = array();
|
||||
|
||||
/**
|
||||
* @var array $relations an array containing all the Doctrine_Relation objects for this table
|
||||
*/
|
||||
private $relations = array();
|
||||
|
||||
/**
|
||||
* @var array $primaryKeys an array containing all primary key column names
|
||||
*/
|
||||
private $primaryKeys = array();
|
||||
|
||||
/**
|
||||
* @var mixed $identifier
|
||||
*/
|
||||
private $identifier;
|
||||
|
||||
/**
|
||||
* @see Doctrine_Identifier constants
|
||||
* @var integer $identifierType the type of identifier this table uses
|
||||
*/
|
||||
private $identifierType;
|
||||
|
||||
/**
|
||||
* @var Doctrine_Connection $conn Doctrine_Connection object that created this table
|
||||
*/
|
||||
private $conn;
|
||||
|
||||
/**
|
||||
* @var string $name
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var array $identityMap first level cache
|
||||
*/
|
||||
private $identityMap = array();
|
||||
|
||||
/**
|
||||
* @var Doctrine_Table_Repository $repository record repository
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* @var array $columns an array of column definitions,
|
||||
* keys as column names and values as column definitions
|
||||
@ -89,28 +99,34 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
* )
|
||||
*/
|
||||
protected $columns = array();
|
||||
|
||||
/**
|
||||
* @var array $columnAliases an array of column aliases
|
||||
* keys as column aliases and values as column names
|
||||
*/
|
||||
protected $columnAliases = array();
|
||||
|
||||
/**
|
||||
* @var array $bound bound relations
|
||||
*/
|
||||
private $bound = array();
|
||||
|
||||
/**
|
||||
* @var array $boundAliases bound relation aliases
|
||||
*/
|
||||
private $boundAliases = array();
|
||||
|
||||
/**
|
||||
* @var integer $columnCount cached column count, Doctrine_Record uses this column count in when
|
||||
* determining its state
|
||||
*/
|
||||
private $columnCount;
|
||||
|
||||
/**
|
||||
* @var boolean $hasDefaultValues whether or not this table has default values
|
||||
*/
|
||||
private $hasDefaultValues;
|
||||
|
||||
/**
|
||||
* @var array $options an array containing all options
|
||||
*
|
||||
@ -160,10 +176,12 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
'treeOptions' => null,
|
||||
'indexes' => array(),
|
||||
);
|
||||
|
||||
/**
|
||||
* @var Doctrine_Tree $tree tree object associated with this table
|
||||
*/
|
||||
protected $tree;
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
* @throws Doctrine_Connection_Exception if there are no opened connections
|
||||
@ -301,6 +319,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
|
||||
$this->repository = new Doctrine_Table_Repository($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* export
|
||||
* exports this table to database based on column and option definitions
|
||||
@ -373,6 +392,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* exportConstraints
|
||||
* exports the constraints of this table into database based on option definitions
|
||||
@ -395,6 +415,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __get
|
||||
* an alias for getOption
|
||||
@ -408,6 +429,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* __isset
|
||||
*
|
||||
@ -417,6 +439,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return isset($this->options[$option]);
|
||||
}
|
||||
|
||||
/**
|
||||
* addForeignKey
|
||||
*
|
||||
@ -428,6 +451,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
$this->options['foreignKeys'][] = $definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* addIndex
|
||||
*
|
||||
@ -440,6 +464,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$index = $this->conn->getIndexName($index);
|
||||
$this->options['indexes'][$index] = $definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* getIndex
|
||||
*
|
||||
@ -453,6 +478,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* createQuery
|
||||
* creates a new Doctrine_Query object and adds the component name
|
||||
@ -464,6 +490,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return Doctrine_Query::create()->from($this->getComponentName());
|
||||
}
|
||||
|
||||
/**
|
||||
* getRepository
|
||||
*
|
||||
@ -498,6 +525,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* getColumnName
|
||||
*
|
||||
@ -516,6 +544,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
|
||||
return $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* setColumn
|
||||
*
|
||||
@ -567,6 +596,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$this->hasDefaultValues = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* hasDefaultValues
|
||||
* returns true if this table has default values, otherwise false
|
||||
@ -577,6 +607,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return $this->hasDefaultValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* getDefaultValueOf
|
||||
* returns the default value(if any) for given column
|
||||
@ -596,6 +627,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@ -603,6 +635,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
@ -610,6 +643,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return $this->identifierType;
|
||||
}
|
||||
|
||||
/**
|
||||
* hasColumn
|
||||
* @return boolean
|
||||
@ -618,6 +652,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return isset($this->columns[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $key
|
||||
* @return void
|
||||
@ -633,6 +668,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* returns all primary keys
|
||||
* @return array
|
||||
@ -641,6 +677,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return $this->primaryKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
@ -648,6 +685,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return in_array($key,$this->primaryKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns all bound relations
|
||||
*
|
||||
@ -657,6 +695,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return $this->bound;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a bound relation array
|
||||
*
|
||||
@ -670,6 +709,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return $this->bound[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a bound relation array
|
||||
*
|
||||
@ -687,6 +727,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
throw new Doctrine_Table_Exception('Unknown bound ' . $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the alias for given component name
|
||||
*
|
||||
@ -700,6 +741,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns component name for given alias
|
||||
*
|
||||
@ -713,6 +755,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* unbinds all relations
|
||||
*
|
||||
@ -724,6 +767,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$this->relations = array();
|
||||
$this->boundAliases = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* unbinds a relation
|
||||
* returns true on success, false on failure
|
||||
@ -746,6 +790,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* binds a relation
|
||||
*
|
||||
@ -790,6 +835,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$this->bound[$alias] = array_merge($this->bound[$alias], $opt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Doctrine_Connection
|
||||
*/
|
||||
@ -797,6 +843,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* hasRelatedComponent
|
||||
* @return boolean
|
||||
@ -805,6 +852,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return (strpos($this->bound[$name]['field'], $component . '.') !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name component name of which a foreign key object is bound
|
||||
* @return boolean
|
||||
@ -821,6 +869,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getRelation
|
||||
*
|
||||
@ -985,6 +1034,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array containing all foreign key objects
|
||||
*
|
||||
@ -998,6 +1048,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
|
||||
return $this->relations;
|
||||
}
|
||||
|
||||
/**
|
||||
* create
|
||||
* creates a new record
|
||||
@ -1011,6 +1062,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$this->data = array();
|
||||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* finds a record by its identifier
|
||||
*
|
||||
@ -1042,6 +1094,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* applyInheritance
|
||||
* @param $where query where part to be modified
|
||||
@ -1059,6 +1112,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* findAll
|
||||
* returns a collection of records
|
||||
@ -1071,6 +1125,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$users = $graph->query("FROM ".$this->options['name']);
|
||||
return $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* findByDql
|
||||
* finds records with given DQL where clause
|
||||
@ -1089,6 +1144,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
public function findByDql($dql, array $params = array()) {
|
||||
return $this->findBySql($dql, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear
|
||||
* clears the first level cache (identityMap)
|
||||
@ -1099,6 +1155,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
$this->identityMap = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* getRecord
|
||||
* first checks if record exists in identityMap, if not
|
||||
@ -1154,7 +1211,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) {
|
||||
@ -1162,7 +1219,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$inheritanceMap = $table->getOption('inheritanceMap');
|
||||
$nomatch = false;
|
||||
foreach ($inheritanceMap as $key => $value) {
|
||||
if (!isset($this->data[$key]) || $this->data[$key] != $value) {
|
||||
if ( ! isset($this->data[$key]) || $this->data[$key] != $value) {
|
||||
$nomatch = true;
|
||||
break;
|
||||
}
|
||||
@ -1195,6 +1252,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return $this->getRecord();
|
||||
}
|
||||
|
||||
/**
|
||||
* count
|
||||
*
|
||||
@ -1205,6 +1263,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$a = $this->conn->getDBH()->query("SELECT COUNT(1) FROM ".$this->options['tableName'])->fetch(PDO::FETCH_NUM);
|
||||
return current($a);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Doctrine_Query a Doctrine_Query object
|
||||
*/
|
||||
@ -1214,6 +1273,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$graph->load($this->getComponentName());
|
||||
return $graph;
|
||||
}
|
||||
|
||||
/**
|
||||
* execute
|
||||
* @param string $query
|
||||
@ -1240,6 +1300,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return $coll;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @return array
|
||||
@ -1252,6 +1313,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* enumValue
|
||||
*
|
||||
@ -1266,6 +1328,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
|
||||
return isset($this->columns[$field][2]['values'][$index]) ? $this->columns[$field][2]['values'][$index] : $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* enumIndex
|
||||
*
|
||||
@ -1279,6 +1342,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
|
||||
return array_search($value, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* invokeSet
|
||||
*
|
||||
@ -1290,7 +1354,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
return $value;
|
||||
}
|
||||
$prefix = $this->getAttribute(Doctrine::ATTR_ACCESSOR_PREFIX_SET);
|
||||
if (!$prefix)
|
||||
if ( ! $prefix)
|
||||
$prefix = 'set';
|
||||
|
||||
$method = $prefix . $name;
|
||||
@ -1301,6 +1365,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* invokeGet
|
||||
*
|
||||
@ -1312,7 +1377,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
return $value;
|
||||
}
|
||||
$prefix = $this->getAttribute(Doctrine::ATTR_ACCESSOR_PREFIX_GET);
|
||||
if (!$prefix)
|
||||
if ( ! $prefix)
|
||||
$prefix = 'get';
|
||||
|
||||
$method = $prefix . $name;
|
||||
@ -1336,6 +1401,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getColumnCount
|
||||
*
|
||||
@ -1355,6 +1421,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array containing all the column names
|
||||
*
|
||||
@ -1377,6 +1444,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTypeOf
|
||||
*
|
||||
@ -1389,6 +1457,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* setData
|
||||
* doctrine uses this function internally
|
||||
@ -1401,6 +1470,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the maximum primary key value
|
||||
*
|
||||
@ -1413,6 +1483,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$data = $stmt->fetch(PDO::FETCH_NUM);
|
||||
return isset($data[0])?$data[0]:1;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns internal data, used by Doctrine_Record instances
|
||||
* when retrieving data from database
|
||||
@ -1423,6 +1494,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter for associated tree
|
||||
*
|
||||
@ -1453,6 +1525,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
$this->options['tableName'] = $tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* determine if table acts as tree
|
||||
*
|
||||
@ -1461,6 +1534,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
public function isTree() {
|
||||
return ( ! is_null($this->options['treeImpl'])) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a string representation of this object
|
||||
*
|
||||
|
@ -349,7 +349,7 @@ final class Doctrine
|
||||
* HYDRATION CONSTANTS
|
||||
*/
|
||||
const HYDRATE_RECORD = 2;
|
||||
|
||||
|
||||
/**
|
||||
* HYDRATE_ARRAY
|
||||
*/
|
||||
@ -736,7 +736,7 @@ final class Doctrine
|
||||
*/
|
||||
public static function createDatabases($specifiedConnections = array())
|
||||
{
|
||||
if (!is_array($specifiedConnections)) {
|
||||
if ( ! is_array($specifiedConnections)) {
|
||||
$specifiedConnections = (array) $specifiedConnections;
|
||||
}
|
||||
|
||||
@ -744,7 +744,7 @@ final class Doctrine
|
||||
$connections = $manager->getConnections();
|
||||
|
||||
foreach ($connections as $name => $connection) {
|
||||
if (!empty($specifiedConnections) && !in_array($name, $specifiedConnections)) {
|
||||
if ( ! empty($specifiedConnections) && !in_array($name, $specifiedConnections)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -783,7 +783,7 @@ final class Doctrine
|
||||
*/
|
||||
public static function dropDatabases($specifiedConnections = array())
|
||||
{
|
||||
if (!is_array($specifiedConnections)) {
|
||||
if ( ! is_array($specifiedConnections)) {
|
||||
$specifiedConnections = (array) $specifiedConnections;
|
||||
}
|
||||
|
||||
@ -792,7 +792,7 @@ final class Doctrine
|
||||
$connections = $manager->getConnections();
|
||||
|
||||
foreach ($connections as $name => $connection) {
|
||||
if (!empty($specifiedConnections) && !in_array($name, $specifiedConnections)) {
|
||||
if ( ! empty($specifiedConnections) && !in_array($name, $specifiedConnections)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -834,7 +834,7 @@ final class Doctrine
|
||||
{
|
||||
$data = new Doctrine_Data();
|
||||
|
||||
if (!$append) {
|
||||
if ( ! $append) {
|
||||
$data->purge();
|
||||
}
|
||||
|
||||
@ -854,13 +854,13 @@ final class Doctrine
|
||||
{
|
||||
$data = new Doctrine_Data();
|
||||
|
||||
if (!$append) {
|
||||
if ( ! $append) {
|
||||
$data->purge();
|
||||
}
|
||||
|
||||
return $data->importDummyData($num);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* migrate
|
||||
*
|
||||
@ -920,7 +920,7 @@ final class Doctrine
|
||||
|
||||
return $builder->generateMigrationsFromModels($modelsPath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getTable
|
||||
*
|
||||
@ -931,7 +931,7 @@ final class Doctrine
|
||||
{
|
||||
return Doctrine_Manager::table($tableName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* connection
|
||||
*
|
||||
@ -943,7 +943,7 @@ final class Doctrine
|
||||
{
|
||||
return Doctrine_Manager::connection($adapter, $name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* fileFinder
|
||||
*
|
||||
@ -954,7 +954,7 @@ final class Doctrine
|
||||
{
|
||||
return Doctrine_FileFinder::type($type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* compile
|
||||
* method for making a single file of most used doctrine runtime components
|
||||
@ -970,7 +970,7 @@ final class Doctrine
|
||||
{
|
||||
return Doctrine_Compiler::compile($target, $includedDrivers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* simple autoload function
|
||||
* returns true if the class was loaded, otherwise false
|
||||
@ -998,7 +998,7 @@ final class Doctrine
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* dump
|
||||
*
|
||||
@ -1030,7 +1030,7 @@ final class Doctrine
|
||||
}
|
||||
return implode("\n", $ret);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* returns table name from class name
|
||||
*
|
||||
@ -1041,7 +1041,7 @@ final class Doctrine
|
||||
{
|
||||
return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $classname));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* returns class name from table name
|
||||
*
|
||||
@ -1052,7 +1052,7 @@ final class Doctrine
|
||||
{
|
||||
return preg_replace_callback('~(_?)(_)([\w])~', array("Doctrine", "classifyCallback"), ucfirst($tablename));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callback function to classify a classname propperly.
|
||||
*
|
||||
@ -1063,7 +1063,7 @@ final class Doctrine
|
||||
{
|
||||
return $matches[1] . strtoupper($matches[3]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* checks for valid class name (uses camel case and underscores)
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Access
|
||||
*
|
||||
@ -49,6 +50,7 @@ abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements Ar
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* __set an alias of set()
|
||||
*
|
||||
@ -62,6 +64,7 @@ abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements Ar
|
||||
{
|
||||
$this->set($name,$value);
|
||||
}
|
||||
|
||||
/**
|
||||
* __get -- an alias of get()
|
||||
*
|
||||
@ -74,6 +77,7 @@ abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements Ar
|
||||
{
|
||||
return $this->get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* __isset()
|
||||
*
|
||||
@ -85,6 +89,7 @@ abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements Ar
|
||||
{
|
||||
return $this->contains($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* __unset()
|
||||
*
|
||||
@ -96,6 +101,7 @@ abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements Ar
|
||||
{
|
||||
return $this->remove($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @return boolean whether or not this object contains $offset
|
||||
@ -104,6 +110,7 @@ abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements Ar
|
||||
{
|
||||
return $this->contains($offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* offsetGet an alias of get()
|
||||
* @see get, __get
|
||||
@ -114,6 +121,7 @@ abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements Ar
|
||||
{
|
||||
return $this->get($offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* sets $offset to $value
|
||||
* @see set, __set
|
||||
@ -129,6 +137,7 @@ abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements Ar
|
||||
$this->set($offset, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* unset a given offset
|
||||
* @see set, offsetSet, __set
|
||||
|
@ -268,6 +268,7 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter
|
||||
$identQuote = $info->IDENTIFIER_QUOTE_CHAR;
|
||||
return $identQuote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin a transaction.
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Adapter_Interface
|
||||
* This adapter interface should be implemented by all custom adapters
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Adapter_Mock
|
||||
* This class is used for special testing purposes.
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Adapter_Mysqli
|
||||
* This class is used for special testing purposes.
|
||||
|
@ -181,6 +181,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
|
||||
// Oracle doesn't allow the 'AS' keyword between the table identifier/expression and alias.
|
||||
return $this->_quoteIdentifierAs($ident, $alias, ' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Leave autocommit mode and begin a transaction.
|
||||
*
|
||||
@ -190,6 +191,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
|
||||
{
|
||||
$this->_setExecuteMode(OCI_DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit a transaction and return to autocommit mode.
|
||||
*
|
||||
@ -203,6 +205,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
|
||||
}
|
||||
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll back a transaction and return to autocommit mode.
|
||||
*
|
||||
@ -240,6 +243,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $mode
|
||||
* @throws Doctrine_Adapter_Exception
|
||||
@ -257,6 +261,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Adapter_Statement
|
||||
*
|
||||
@ -34,6 +35,7 @@ abstract class Doctrine_Adapter_Statement
|
||||
public function bindValue($no, $value)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Adapter_Statement
|
||||
*
|
||||
@ -43,6 +44,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return boolean Returns TRUE on success or FALSE on failure
|
||||
*/
|
||||
public function bindColumn($column, $param, $type = null);
|
||||
|
||||
/**
|
||||
* bindValue
|
||||
* Binds a value to a corresponding named or question mark
|
||||
@ -58,6 +60,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return boolean Returns TRUE on success or FALSE on failure.
|
||||
*/
|
||||
public function bindValue($param, $value, $type = null);
|
||||
|
||||
/**
|
||||
* bindParam
|
||||
* Binds a PHP variable to a corresponding named or question mark placeholder in the
|
||||
@ -86,6 +89,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return boolean Returns TRUE on success or FALSE on failure.
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array());
|
||||
|
||||
/**
|
||||
* closeCursor
|
||||
* Closes the cursor, enabling the statement to be executed again.
|
||||
@ -93,6 +97,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return boolean Returns TRUE on success or FALSE on failure.
|
||||
*/
|
||||
public function closeCursor();
|
||||
|
||||
/**
|
||||
* columnCount
|
||||
* Returns the number of columns in the result set
|
||||
@ -102,6 +107,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* this method should return 0.
|
||||
*/
|
||||
public function columnCount();
|
||||
|
||||
/**
|
||||
* errorCode
|
||||
* Fetch the SQLSTATE associated with the last operation on the statement handle
|
||||
@ -110,6 +116,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return string error code string
|
||||
*/
|
||||
public function errorCode();
|
||||
|
||||
/**
|
||||
* errorInfo
|
||||
* Fetch extended error information associated with the last operation on the statement handle
|
||||
@ -118,6 +125,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return array error info array
|
||||
*/
|
||||
public function errorInfo();
|
||||
|
||||
/**
|
||||
* execute
|
||||
* Executes a prepared statement
|
||||
@ -134,6 +142,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return boolean Returns TRUE on success or FALSE on failure.
|
||||
*/
|
||||
public function execute($params = null);
|
||||
|
||||
/**
|
||||
* fetch
|
||||
*
|
||||
@ -164,6 +173,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
public function fetch($fetchStyle = Doctrine::FETCH_BOTH,
|
||||
$cursorOrientation = Doctrine::FETCH_ORI_NEXT,
|
||||
$cursorOffset = null);
|
||||
|
||||
/**
|
||||
* fetchAll
|
||||
* Returns an array containing all of the result set rows
|
||||
@ -178,6 +188,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return array
|
||||
*/
|
||||
public function fetchAll($fetchStyle = Doctrine::FETCH_BOTH);
|
||||
|
||||
/**
|
||||
* fetchColumn
|
||||
* Returns a single column from the next row of a
|
||||
@ -190,6 +201,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return string returns a single column in the next row of a result set.
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0);
|
||||
|
||||
/**
|
||||
* fetchObject
|
||||
* Fetches the next row and returns it as an object.
|
||||
@ -204,6 +216,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* to the column names or FALSE in case of an error.
|
||||
*/
|
||||
public function fetchObject($className = 'stdClass', $args = array());
|
||||
|
||||
/**
|
||||
* getAttribute
|
||||
* Retrieve a statement attribute
|
||||
@ -213,6 +226,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return mixed the attribute value
|
||||
*/
|
||||
public function getAttribute($attribute);
|
||||
|
||||
/**
|
||||
* getColumnMeta
|
||||
* Returns metadata for a column in a result set
|
||||
@ -230,6 +244,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* pdo_type The type of this column as represented by the PDO::PARAM_* constants.
|
||||
*/
|
||||
public function getColumnMeta($column);
|
||||
|
||||
/**
|
||||
* nextRowset
|
||||
* Advances to the next rowset in a multi-rowset statement handle
|
||||
@ -242,6 +257,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return boolean Returns TRUE on success or FALSE on failure.
|
||||
*/
|
||||
public function nextRowset();
|
||||
|
||||
/**
|
||||
* rowCount
|
||||
* rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
|
||||
@ -255,6 +271,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return integer Returns the number of rows.
|
||||
*/
|
||||
public function rowCount();
|
||||
|
||||
/**
|
||||
* setAttribute
|
||||
* Set a statement attribute
|
||||
@ -264,6 +281,7 @@ interface Doctrine_Adapter_Statement_Interface
|
||||
* @return boolean Returns TRUE on success or FALSE on failure.
|
||||
*/
|
||||
public function setAttribute($attribute, $value);
|
||||
|
||||
/**
|
||||
* setFetchMode
|
||||
* Set the default fetch mode for this statement
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Adapter_Statement_Mock
|
||||
* This class is used for special testing purposes.
|
||||
@ -40,6 +41,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
$this->mock = $mock;
|
||||
}
|
||||
|
||||
/**
|
||||
* bindColumn
|
||||
* Bind a column to a PHP variable
|
||||
@ -55,6 +57,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* bindValue
|
||||
* Binds a value to a corresponding named or question mark
|
||||
@ -73,6 +76,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* bindParam
|
||||
* Binds a PHP variable to a corresponding named or question mark placeholder in the
|
||||
@ -104,6 +108,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* closeCursor
|
||||
* Closes the cursor, enabling the statement to be executed again.
|
||||
@ -114,6 +119,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* columnCount
|
||||
* Returns the number of columns in the result set
|
||||
@ -126,6 +132,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* errorCode
|
||||
* Fetch the SQLSTATE associated with the last operation on the statement handle
|
||||
@ -137,6 +144,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* errorInfo
|
||||
* Fetch extended error information associated with the last operation on the statement handle
|
||||
@ -148,6 +156,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch
|
||||
*
|
||||
@ -181,6 +190,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchAll
|
||||
* Returns an array containing all of the result set rows
|
||||
@ -198,6 +208,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* execute
|
||||
* Executes a prepared statement
|
||||
@ -220,6 +231,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchColumn
|
||||
* Returns a single column from the next row of a
|
||||
@ -235,6 +247,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchObject
|
||||
* Fetches the next row and returns it as an object.
|
||||
@ -252,6 +265,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return new $className();
|
||||
}
|
||||
|
||||
/**
|
||||
* nextRowset
|
||||
* Advances to the next rowset in a multi-rowset statement handle
|
||||
@ -267,6 +281,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* rowCount
|
||||
* rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
|
||||
@ -283,6 +298,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* getColumnMeta
|
||||
* Returns metadata for a column in a result set
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_AuditLog
|
||||
*
|
||||
|
@ -42,22 +42,27 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
'cleanPropability' => 0.01,
|
||||
'statsFile' => '../data/stats.cache',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $_queries query stack
|
||||
*/
|
||||
protected $_queries = array();
|
||||
|
||||
/**
|
||||
* @var Doctrine_Cache_Interface $_driver the cache driver object
|
||||
*/
|
||||
protected $_driver;
|
||||
|
||||
/**
|
||||
* @var array $data current cache data array
|
||||
*/
|
||||
protected $_data = array();
|
||||
|
||||
/**
|
||||
* @var boolean $success the success of last operation
|
||||
*/
|
||||
protected $_success = false;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
@ -83,6 +88,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
$this->_driver = new $class($options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getDriver
|
||||
* returns the current cache driver
|
||||
@ -93,6 +99,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
{
|
||||
return $this->_driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* setOption
|
||||
*
|
||||
@ -113,6 +120,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getOption
|
||||
*
|
||||
@ -127,6 +135,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
|
||||
return $this->_options[$option];
|
||||
}
|
||||
|
||||
/**
|
||||
* add
|
||||
* adds a query to internal query stack
|
||||
@ -143,6 +152,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
$this->_queries[] = $query;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getQueries
|
||||
*
|
||||
@ -161,6 +171,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
|
||||
return $this->_queries;
|
||||
}
|
||||
|
||||
/**
|
||||
* pop
|
||||
*
|
||||
@ -171,6 +182,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
{
|
||||
return array_pop($this->_queries);
|
||||
}
|
||||
|
||||
/**
|
||||
* reset
|
||||
*
|
||||
@ -181,6 +193,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
{
|
||||
$this->_queries = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* count
|
||||
*
|
||||
@ -190,6 +203,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
{
|
||||
return count($this->_queries);
|
||||
}
|
||||
|
||||
/**
|
||||
* getIterator
|
||||
*
|
||||
@ -199,6 +213,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
{
|
||||
return new ArrayIterator($this->_queries);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean whether or not the last cache operation was successful
|
||||
*/
|
||||
@ -206,6 +221,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
{
|
||||
return $this->_success;
|
||||
}
|
||||
|
||||
/**
|
||||
* save
|
||||
*
|
||||
@ -241,6 +257,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* readStats
|
||||
*
|
||||
@ -257,6 +274,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* appendStats
|
||||
*
|
||||
@ -278,6 +296,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* preQuery
|
||||
* listens on the Doctrine_Event preQuery event
|
||||
@ -322,6 +341,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* preFetch
|
||||
* listens the preFetch event of Doctrine_Connection_Statement
|
||||
@ -337,6 +357,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
next($this->_data);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* preFetch
|
||||
* listens the preFetchAll event of Doctrine_Connection_Statement
|
||||
@ -349,6 +370,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat
|
||||
{
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* preExecute
|
||||
* listens the preExecute event of Doctrine_Connection_Statement
|
||||
|
@ -44,6 +44,7 @@ class Doctrine_Cache_Apc extends Doctrine_Cache_Driver
|
||||
}
|
||||
parent::__construct($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a cache is available for the given id and (if yes) return it (false else)
|
||||
*
|
||||
@ -61,6 +62,7 @@ class Doctrine_Cache_Apc extends Doctrine_Cache_Driver
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a cache is available or not (for the given id)
|
||||
*
|
||||
@ -75,6 +77,7 @@ class Doctrine_Cache_Apc extends Doctrine_Cache_Driver
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save some string datas into a cache record
|
||||
*
|
||||
@ -91,6 +94,7 @@ class Doctrine_Cache_Apc extends Doctrine_Cache_Driver
|
||||
|
||||
return (bool) apc_store($id, array($data, time()), $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a cache record
|
||||
*
|
||||
|
@ -53,6 +53,7 @@ class Doctrine_Cache_Array implements Countable, Doctrine_Cache_Interface
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a cache is available or not (for the given id)
|
||||
*
|
||||
@ -63,6 +64,7 @@ class Doctrine_Cache_Array implements Countable, Doctrine_Cache_Interface
|
||||
{
|
||||
return isset($this->data[$id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save some string datas into a cache record
|
||||
*
|
||||
@ -77,6 +79,7 @@ class Doctrine_Cache_Array implements Countable, Doctrine_Cache_Interface
|
||||
{
|
||||
$this->data[$id] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a cache record
|
||||
*
|
||||
@ -87,6 +90,7 @@ class Doctrine_Cache_Array implements Countable, Doctrine_Cache_Interface
|
||||
{
|
||||
unset($this->data[$id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all cache record
|
||||
*
|
||||
@ -96,6 +100,7 @@ class Doctrine_Cache_Array implements Countable, Doctrine_Cache_Interface
|
||||
{
|
||||
$this->data = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* count
|
||||
*
|
||||
|
@ -54,6 +54,7 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
|
||||
|
||||
$this->_options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* getConnection
|
||||
* returns the connection object associated with this cache driver
|
||||
@ -64,6 +65,7 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
|
||||
{
|
||||
return $this->_options['connection'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a cache is available for the given id and (if yes) return it (false else)
|
||||
*
|
||||
@ -90,6 +92,7 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
|
||||
|
||||
return unserialize($result[0]['data']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a cache is available or not (for the given id)
|
||||
*
|
||||
@ -103,6 +106,7 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
|
||||
|
||||
return $this->getConnection()->fetchOne($sql, array($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save some string datas into a cache record
|
||||
*
|
||||
@ -128,6 +132,7 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
|
||||
|
||||
return (bool) $this->getConnection()->exec($sql, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a cache record
|
||||
*
|
||||
@ -140,7 +145,7 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
|
||||
|
||||
return (bool) $this->getConnection()->exec($sql, array($id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes all cache records
|
||||
*
|
||||
@ -152,7 +157,7 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
|
||||
|
||||
return (bool) $this->getConnection()->exec($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* count
|
||||
* returns the number of cached elements
|
||||
@ -165,7 +170,7 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
|
||||
|
||||
return (int) $this->getConnection()->fetchOne($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the cache table.
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@ abstract class Doctrine_Cache_Driver implements Doctrine_Cache_Interface
|
||||
* @var array $_options an array of options
|
||||
*/
|
||||
protected $_options = array();
|
||||
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
@ -46,6 +46,7 @@ abstract class Doctrine_Cache_Driver implements Doctrine_Cache_Interface
|
||||
{
|
||||
$this->_options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* setOption
|
||||
*
|
||||
@ -61,6 +62,7 @@ abstract class Doctrine_Cache_Driver implements Doctrine_Cache_Interface
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* getOption
|
||||
*
|
||||
|
@ -36,6 +36,7 @@ class Doctrine_Cache_Memcache extends Doctrine_Cache_Driver
|
||||
* @var Memcache $_memcache memcache object
|
||||
*/
|
||||
protected $_memcache = null;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
@ -69,6 +70,7 @@ class Doctrine_Cache_Memcache extends Doctrine_Cache_Driver
|
||||
$this->_memcache->addServer($server['host'], $server['port'], $server['persistent']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a cache is available for the given id and (if yes) return it (false else)
|
||||
*
|
||||
@ -88,6 +90,7 @@ class Doctrine_Cache_Memcache extends Doctrine_Cache_Driver
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a cache is available or not (for the given id)
|
||||
*
|
||||
@ -98,6 +101,7 @@ class Doctrine_Cache_Memcache extends Doctrine_Cache_Driver
|
||||
{
|
||||
return (bool) $this->_memcache->get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save some string datas into a cache record
|
||||
*
|
||||
@ -118,6 +122,7 @@ class Doctrine_Cache_Memcache extends Doctrine_Cache_Driver
|
||||
|
||||
$result = $this->_memcache->set($id, $data, $flag, $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a cache record
|
||||
*
|
||||
|
@ -38,7 +38,7 @@ class Doctrine_Cli
|
||||
$scriptName = null,
|
||||
$message = null,
|
||||
$config = array();
|
||||
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
@ -52,7 +52,7 @@ class Doctrine_Cli
|
||||
|
||||
$this->loadTasks();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* notify
|
||||
*
|
||||
@ -63,7 +63,7 @@ class Doctrine_Cli
|
||||
{
|
||||
echo $this->formatter->format($this->taskInstance->getTaskName(), 'INFO') . ' - ' . $this->formatter->format($notification, $style) . "\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* notifyException
|
||||
*
|
||||
@ -109,7 +109,7 @@ class Doctrine_Cli
|
||||
|
||||
$arg1 = isset($args[1]) ? $args[1]:null;
|
||||
|
||||
if (!$arg1 || $arg1 == 'help') {
|
||||
if ( ! $arg1 || $arg1 == 'help') {
|
||||
echo $this->printTasks(null, $arg1 == 'help' ? true:false);
|
||||
return;
|
||||
}
|
||||
@ -121,7 +121,7 @@ class Doctrine_Cli
|
||||
|
||||
$taskClass = $this->_getTaskClassFromArgs($args);
|
||||
|
||||
if (!class_exists($taskClass)) {
|
||||
if ( ! class_exists($taskClass)) {
|
||||
throw new Doctrine_Cli_Exception('Cli task could not be found: ' . $taskClass);
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ class Doctrine_Cli
|
||||
// Now lets fill in the entered arguments to the prepared array
|
||||
$copy = $args;
|
||||
foreach ($prepared as $key => $value) {
|
||||
if (!$value && !empty($copy)) {
|
||||
if ( ! $value && !empty($copy)) {
|
||||
$prepared[$key] = $copy[0];
|
||||
unset($copy[0]);
|
||||
$copy = array_values($copy);
|
||||
@ -229,7 +229,7 @@ class Doctrine_Cli
|
||||
|
||||
$requiredArguments = $taskInstance->getRequiredArgumentsDescriptions();
|
||||
|
||||
if (!empty($requiredArguments)) {
|
||||
if ( ! empty($requiredArguments)) {
|
||||
foreach ($requiredArguments as $name => $description) {
|
||||
$args .= $this->formatter->format($name, "ERROR");
|
||||
|
||||
@ -245,7 +245,7 @@ class Doctrine_Cli
|
||||
|
||||
$optionalArguments = $taskInstance->getOptionalArgumentsDescriptions();
|
||||
|
||||
if (!empty($optionalArguments)) {
|
||||
if ( ! empty($optionalArguments)) {
|
||||
foreach ($optionalArguments as $name => $description) {
|
||||
$args .= $name . ' - ' . $description."\n";
|
||||
}
|
||||
@ -259,7 +259,7 @@ class Doctrine_Cli
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* loadTasks
|
||||
*
|
||||
@ -286,7 +286,7 @@ class Doctrine_Cli
|
||||
|
||||
$className = 'Doctrine_Task_' . $e[0];
|
||||
|
||||
if (!class_exists($className)) {
|
||||
if ( ! class_exists($className)) {
|
||||
require_once($file->getPathName());
|
||||
|
||||
$class = new ReflectionClass($className);
|
||||
|
@ -69,17 +69,17 @@ class Doctrine_Cli_AnsiColorFormatter extends Doctrine_Cli_Formatter
|
||||
*/
|
||||
public function format($text = '', $parameters = array(), $stream = STDOUT)
|
||||
{
|
||||
if (!$this->supportsColors($stream))
|
||||
if ( ! $this->supportsColors($stream))
|
||||
{
|
||||
return $text;
|
||||
}
|
||||
|
||||
if (!is_array($parameters) && 'NONE' == $parameters)
|
||||
if ( ! is_array($parameters) && 'NONE' == $parameters)
|
||||
{
|
||||
return $text;
|
||||
}
|
||||
|
||||
if (!is_array($parameters) && isset($this->styles[$parameters]))
|
||||
if ( ! is_array($parameters) && isset($this->styles[$parameters]))
|
||||
{
|
||||
$parameters = $this->styles[$parameters];
|
||||
}
|
||||
@ -128,7 +128,7 @@ class Doctrine_Cli_AnsiColorFormatter extends Doctrine_Cli_Formatter
|
||||
*/
|
||||
public function excerpt($text, $size = null)
|
||||
{
|
||||
if (!$size)
|
||||
if ( ! $size)
|
||||
{
|
||||
$size = $this->size;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class Doctrine_Cli_Formatter
|
||||
*/
|
||||
public function excerpt($text, $size = null)
|
||||
{
|
||||
if (!$size)
|
||||
if ( ! $size)
|
||||
{
|
||||
$size = $this->size;
|
||||
}
|
||||
|
@ -37,30 +37,37 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
* @var array $data an array containing the records of this collection
|
||||
*/
|
||||
protected $data = array();
|
||||
|
||||
/**
|
||||
* @var Doctrine_Table $table each collection has only records of specified table
|
||||
*/
|
||||
protected $_table;
|
||||
|
||||
/**
|
||||
* @var array $_snapshot a snapshot of the fetched data
|
||||
*/
|
||||
protected $_snapshot = array();
|
||||
|
||||
/**
|
||||
* @var Doctrine_Record $reference collection can belong to a record
|
||||
*/
|
||||
protected $reference;
|
||||
|
||||
/**
|
||||
* @var string $referenceField the reference field of the collection
|
||||
*/
|
||||
protected $referenceField;
|
||||
|
||||
/**
|
||||
* @var Doctrine_Relation the record this collection is related to, if any
|
||||
*/
|
||||
protected $relation;
|
||||
|
||||
/**
|
||||
* @var string $keyColumn the name of the column that is used for collection key mapping
|
||||
*/
|
||||
protected $keyColumn;
|
||||
|
||||
/**
|
||||
* @var Doctrine_Null $null used for extremely fast null value testing
|
||||
*/
|
||||
@ -88,6 +95,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
$this->keyColumn = $keyColumn;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* initNullObject
|
||||
* initializes the null object for this collection
|
||||
@ -98,6 +106,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
self::$null = $null;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTable
|
||||
* returns the table this collection belongs to
|
||||
@ -108,6 +117,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* setData
|
||||
*
|
||||
@ -118,6 +128,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* this method is automatically called when this Doctrine_Collection is serialized
|
||||
*
|
||||
@ -138,6 +149,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
|
||||
return serialize($vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* unseralize
|
||||
* this method is automatically called everytime a Doctrine_Collection object is unserialized
|
||||
@ -165,6 +177,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
$this->keyColumn = $keyColumn;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setKeyColumn
|
||||
* sets the key column for this collection
|
||||
@ -178,6 +191,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getKeyColumn
|
||||
* returns the name of the key column
|
||||
@ -188,6 +202,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return $this->column;
|
||||
}
|
||||
|
||||
/**
|
||||
* getData
|
||||
* returns all the records as an array
|
||||
@ -198,6 +213,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* getFirst
|
||||
* returns the first record in the collection
|
||||
@ -208,6 +224,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return reset($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* getLast
|
||||
* returns the last record in the collection
|
||||
@ -218,6 +235,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return end($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* setReference
|
||||
* sets a reference pointer
|
||||
@ -247,6 +265,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getReference
|
||||
*
|
||||
@ -256,6 +275,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* remove
|
||||
* removes a specified collection element
|
||||
@ -270,6 +290,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
unset($this->data[$key]);
|
||||
return $removed;
|
||||
}
|
||||
|
||||
/**
|
||||
* contains
|
||||
* whether or not this collection contains a specified element
|
||||
@ -285,6 +306,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return array_search($record, $this->data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
* returns a record for given key
|
||||
@ -350,6 +372,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns all keys
|
||||
* @return array
|
||||
@ -358,6 +381,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return array_keys($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* count
|
||||
* this class implements interface countable
|
||||
@ -369,6 +393,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return count($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* set
|
||||
* @param integer $key
|
||||
@ -383,6 +408,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
|
||||
$this->data[$key] = $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* adds a record to collection
|
||||
* @param Doctrine_Record $record record to be added
|
||||
@ -430,6 +456,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* loadRelated
|
||||
*
|
||||
@ -475,6 +502,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
|
||||
$this->populateRelated($name, $coll);
|
||||
}
|
||||
|
||||
/**
|
||||
* populateRelated
|
||||
*
|
||||
@ -533,6 +561,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getNormalIterator
|
||||
* returns normal iterator - an iterator that will not expand this collection
|
||||
@ -543,6 +572,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return new Doctrine_Collection_Iterator_Normal($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* takeSnapshot
|
||||
* takes a snapshot from this collection
|
||||
@ -562,6 +592,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getSnapshot
|
||||
* returns the data of the last snapshot
|
||||
@ -572,6 +603,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return $this->_snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* processDiff
|
||||
* processes the difference of the last snapshot and the current data
|
||||
@ -592,6 +624,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* toArray
|
||||
* Mimics the result of a $query->execute(array(), Doctrine::FETCH_ARRAY);
|
||||
@ -646,6 +679,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
{
|
||||
return array_udiff($this->data, $this->_snapshot, array($this, "compareRecords"));
|
||||
}
|
||||
|
||||
/**
|
||||
* compareRecords
|
||||
* Compares two records. To be used on _snapshot diffs using array_udiff
|
||||
@ -655,6 +689,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
if ($a->getOid() == $b->getOid()) return 0;
|
||||
return ($a->getOid() > $b->getOid()) ? 1 : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* save
|
||||
* saves all records of this collection and processes the
|
||||
@ -682,6 +717,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete
|
||||
* single shot delete
|
||||
@ -709,6 +745,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getIterator
|
||||
* @return object ArrayIterator
|
||||
@ -718,6 +755,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
$data = $this->data;
|
||||
return new ArrayIterator($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a string representation of this object
|
||||
*/
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Collection_Exception
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Collection_Iterator
|
||||
* iterates through Doctrine_Collection
|
||||
@ -36,18 +37,22 @@ abstract class Doctrine_Collection_Iterator implements Iterator
|
||||
* @var Doctrine_Collection $collection
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
/**
|
||||
* @var array $keys
|
||||
*/
|
||||
protected $keys;
|
||||
|
||||
/**
|
||||
* @var mixed $key
|
||||
*/
|
||||
protected $key;
|
||||
|
||||
/**
|
||||
* @var integer $index
|
||||
*/
|
||||
protected $index;
|
||||
|
||||
/**
|
||||
* @var integer $count
|
||||
*/
|
||||
@ -63,6 +68,7 @@ abstract class Doctrine_Collection_Iterator implements Iterator
|
||||
$this->keys = $this->collection->getKeys();
|
||||
$this->count = $this->collection->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* rewinds the iterator
|
||||
*
|
||||
@ -86,6 +92,7 @@ abstract class Doctrine_Collection_Iterator implements Iterator
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the current record
|
||||
*
|
||||
@ -95,6 +102,7 @@ abstract class Doctrine_Collection_Iterator implements Iterator
|
||||
{
|
||||
return $this->collection->get($this->key);
|
||||
}
|
||||
|
||||
/**
|
||||
* advances the internal pointer
|
||||
*
|
||||
|
@ -37,6 +37,7 @@ class Doctrine_Collection_Offset extends Doctrine_Collection
|
||||
* @var integer $limit
|
||||
*/
|
||||
private $limit;
|
||||
|
||||
/**
|
||||
* @param Doctrine_Table $table
|
||||
*/
|
||||
@ -45,6 +46,7 @@ class Doctrine_Collection_Offset extends Doctrine_Collection
|
||||
parent::__construct($table);
|
||||
$this->limit = $table->getAttribute(Doctrine::ATTR_COLL_LIMIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
@ -52,6 +54,7 @@ class Doctrine_Collection_Offset extends Doctrine_Collection
|
||||
{
|
||||
return $this->limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Doctrine_Collection_Iterator_Expandable
|
||||
*/
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Column
|
||||
* This class represents a database column
|
||||
@ -39,6 +40,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
'type' => null,
|
||||
'length' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $definition
|
||||
*/
|
||||
@ -46,6 +48,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
{
|
||||
$this->_definition = $definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@ -53,6 +56,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
{
|
||||
return $this->_definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* contains
|
||||
*
|
||||
@ -62,6 +66,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
{
|
||||
return isset($this->_definition[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
*
|
||||
@ -76,6 +81,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
|
||||
return $this->_definition[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* set
|
||||
*
|
||||
@ -86,6 +92,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
{
|
||||
$this->_definition[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @return array
|
||||
@ -98,6 +105,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* enumValue
|
||||
*
|
||||
@ -113,6 +121,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
|
||||
return isset($this->_definition['values'][$index]) ? $this->_definition['values'][$index] : $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* enumIndex
|
||||
*
|
||||
@ -126,6 +135,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
|
||||
return array_search($value, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* count
|
||||
*
|
||||
@ -135,6 +145,7 @@ class Doctrine_Column extends Doctrine_Access implements IteratorAggregate, Coun
|
||||
{
|
||||
return count($this->_definition);
|
||||
}
|
||||
|
||||
/**
|
||||
* getIterator
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Compiler
|
||||
* This class can be used for compiling the entire Doctrine framework into a single file
|
||||
@ -42,14 +43,14 @@ class Doctrine_Compiler
|
||||
*/
|
||||
public static function compile($target = null, $includedDrivers = array())
|
||||
{
|
||||
if (!is_array($includedDrivers)) {
|
||||
if ( ! is_array($includedDrivers)) {
|
||||
$includedDrivers = array($includedDrivers);
|
||||
}
|
||||
|
||||
$excludedDrivers = array();
|
||||
|
||||
// If we have an array of specified drivers then lets determine which drivers we should exclude
|
||||
if (!empty($includedDrivers)) {
|
||||
if ( ! empty($includedDrivers)) {
|
||||
$drivers = array('db2',
|
||||
'firebird',
|
||||
'informix',
|
||||
@ -86,7 +87,7 @@ class Doctrine_Compiler
|
||||
}
|
||||
|
||||
// Exclude drivers
|
||||
if (!empty($excludedDrivers)) {
|
||||
if ( ! empty($excludedDrivers)) {
|
||||
foreach ($excludedDrivers as $excludedDriver) {
|
||||
$excludedDriver = ucfirst($excludedDriver);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Compiler_Exception
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Configurable
|
||||
* the base for Doctrine_Table, Doctrine_Manager and Doctrine_Connection
|
||||
@ -37,16 +38,19 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
* @var array $attributes an array of containing all attributes
|
||||
*/
|
||||
protected $attributes = array();
|
||||
|
||||
/**
|
||||
* @var Doctrine_Configurable $parent the parent of this component
|
||||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* @var array $_impl an array containing concrete implementations for class templates
|
||||
* keys as template names and values as names of the concrete
|
||||
* implementation classes
|
||||
*/
|
||||
protected $_impl = array();
|
||||
|
||||
/**
|
||||
* setAttribute
|
||||
* sets a given attribute
|
||||
@ -137,6 +141,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
$this->attributes[$attribute] = $value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* setImpl
|
||||
* binds given class to given template name
|
||||
@ -153,6 +158,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getImpl
|
||||
* returns the implementation for given class
|
||||
@ -169,6 +175,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
}
|
||||
return $this->_impl[$template];
|
||||
}
|
||||
|
||||
/**
|
||||
* getCacheDriver
|
||||
*
|
||||
@ -182,6 +189,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
|
||||
return $this->attributes[Doctrine::ATTR_CACHE];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Doctrine_EventListener $listener
|
||||
* @return void
|
||||
@ -190,6 +198,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
{
|
||||
return $this->setListener($listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* addRecordListener
|
||||
*
|
||||
@ -207,6 +216,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getListener
|
||||
*
|
||||
@ -222,6 +232,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
}
|
||||
return $this->attributes[Doctrine::ATTR_RECORD_LISTENER];
|
||||
}
|
||||
|
||||
/**
|
||||
* setListener
|
||||
*
|
||||
@ -239,6 +250,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* addListener
|
||||
*
|
||||
@ -256,6 +268,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getListener
|
||||
*
|
||||
@ -271,6 +284,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
}
|
||||
return $this->attributes[Doctrine::ATTR_LISTENER];
|
||||
}
|
||||
|
||||
/**
|
||||
* setListener
|
||||
*
|
||||
@ -288,6 +302,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the value of an attribute
|
||||
*
|
||||
@ -310,6 +325,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
}
|
||||
return $this->attributes[$attribute];
|
||||
}
|
||||
|
||||
/**
|
||||
* getAttributes
|
||||
* returns all attributes as an array
|
||||
@ -320,6 +336,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
{
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets a parent for this configurable component
|
||||
* the parent must be configurable component itself
|
||||
@ -331,6 +348,7 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
{
|
||||
$this->parent = $component;
|
||||
}
|
||||
|
||||
/**
|
||||
* getParent
|
||||
* returns the parent of this component
|
||||
|
@ -59,31 +59,37 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
* @var $dbh the database handler
|
||||
*/
|
||||
protected $dbh;
|
||||
|
||||
/**
|
||||
* @var array $tables an array containing all the initialized Doctrine_Table objects
|
||||
* keys representing Doctrine_Table component names and values as Doctrine_Table objects
|
||||
*/
|
||||
protected $tables = array();
|
||||
|
||||
/**
|
||||
* @var string $driverName the name of this connection driver
|
||||
*/
|
||||
protected $driverName;
|
||||
|
||||
/**
|
||||
* @var boolean $isConnected whether or not a connection has been established
|
||||
*/
|
||||
protected $isConnected = false;
|
||||
|
||||
/**
|
||||
* @var array $supported an array containing all features this driver supports,
|
||||
* keys representing feature names and values as
|
||||
* one of the following (true, false, 'emulated')
|
||||
*/
|
||||
protected $supported = array();
|
||||
|
||||
/**
|
||||
* @var array $pendingAttributes An array of pending attributes. When setting attributes
|
||||
* no connection is needed. When connected all the pending
|
||||
* attributes are passed to the underlying adapter (usually PDO) instance.
|
||||
*/
|
||||
protected $pendingAttributes = array();
|
||||
|
||||
/**
|
||||
* @var array $modules an array containing all modules
|
||||
* transaction Doctrine_Transaction driver, handles savepoint and transaction isolation abstraction
|
||||
@ -122,6 +128,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
'formatter' => false,
|
||||
'util' => false,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $properties an array of connection properties
|
||||
*/
|
||||
@ -135,12 +142,14 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
'wildcards' => array('%', '_'),
|
||||
'varchar_max_length' => 255,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $serverInfo
|
||||
*/
|
||||
protected $serverInfo = array();
|
||||
|
||||
protected $options = array();
|
||||
|
||||
/**
|
||||
* @var array $availableDrivers an array containing all availible drivers
|
||||
*/
|
||||
@ -192,6 +201,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->getAttribute(Doctrine::ATTR_LISTENER)->onOpen($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* getOption
|
||||
*
|
||||
@ -206,6 +216,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
return $this->options[$option];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getAttribute
|
||||
* retrieves a database connection attribute
|
||||
@ -238,6 +249,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
return $this->pendingAttributes[$attribute];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array of available PDO drivers
|
||||
*/
|
||||
@ -245,6 +257,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return PDO::getAvailableDrivers();
|
||||
}
|
||||
|
||||
/**
|
||||
* setAttribute
|
||||
* sets an attribute
|
||||
@ -266,6 +279,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getName
|
||||
* returns the name of this driver
|
||||
@ -276,6 +290,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->driverName;
|
||||
}
|
||||
|
||||
/**
|
||||
* __get
|
||||
* lazy loads given module and returns it
|
||||
@ -314,6 +329,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $this->modules[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the manager that created this connection
|
||||
*
|
||||
@ -323,6 +339,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->getParent();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the database handler of which this connection uses
|
||||
*
|
||||
@ -334,6 +351,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $this->dbh;
|
||||
}
|
||||
|
||||
/**
|
||||
* connect
|
||||
* connects into database
|
||||
@ -393,6 +411,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
$this->_count++;
|
||||
}
|
||||
|
||||
/**
|
||||
* converts given driver name
|
||||
*
|
||||
@ -401,6 +420,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
public function driverName($name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* supports
|
||||
*
|
||||
@ -413,6 +433,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
&& ($this->supported[$feature] === 'emulated'
|
||||
|| $this->supported[$feature]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
|
||||
* query, except that if there is already a row in the table with the same
|
||||
@ -479,6 +500,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a table row with specified data.
|
||||
*
|
||||
@ -517,6 +539,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charset on the current connection
|
||||
*
|
||||
@ -528,6 +551,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote a string so it can be safely used as a table or column name
|
||||
*
|
||||
@ -571,6 +595,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $this->formatter->quoteIdentifier($str, $checkOption);
|
||||
}
|
||||
|
||||
/**
|
||||
* convertBooleans
|
||||
* some drivers need the boolean values to be converted into integers
|
||||
@ -585,6 +610,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->formatter->convertBooleans($item);
|
||||
}
|
||||
|
||||
/**
|
||||
* quote
|
||||
* quotes given input parameter
|
||||
@ -597,6 +623,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->formatter->quote($input, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the date/time format for the current connection
|
||||
*
|
||||
@ -607,6 +634,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
public function setDateFormat($format = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchAll
|
||||
*
|
||||
@ -618,6 +646,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchOne
|
||||
*
|
||||
@ -630,6 +659,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchColumn($colnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchRow
|
||||
*
|
||||
@ -641,6 +671,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetch(Doctrine::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchArray
|
||||
*
|
||||
@ -652,6 +683,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetch(Doctrine::FETCH_NUM);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchColumn
|
||||
*
|
||||
@ -664,6 +696,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_COLUMN, $colnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchAssoc
|
||||
*
|
||||
@ -675,6 +708,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchBoth
|
||||
*
|
||||
@ -686,6 +720,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* query
|
||||
* queries the database using Doctrine Query Language
|
||||
@ -709,6 +744,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $parser->query($query, $params, $hydrationMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* prepare
|
||||
*
|
||||
@ -737,6 +773,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->rethrowException($e, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* query
|
||||
* queries the database using Doctrine Query Language and returns
|
||||
@ -766,6 +803,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $coll[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* queries the database with limit and offset
|
||||
* added to the query and returns a Doctrine_Connection_Statement object
|
||||
@ -782,6 +820,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
}
|
||||
return $this->execute($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* standaloneQuery
|
||||
*
|
||||
@ -794,6 +833,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->execute($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* execute
|
||||
* @param string $query sql query
|
||||
@ -829,6 +869,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->rethrowException($e, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* exec
|
||||
* @param string $query sql query
|
||||
@ -864,6 +905,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->rethrowException($e, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* rethrowException
|
||||
*
|
||||
@ -889,6 +931,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->getListener()->postError($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* hasTable
|
||||
* whether or not this connection has table $name initialized
|
||||
@ -900,6 +943,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return isset($this->tables[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a table object for given component name
|
||||
*
|
||||
@ -923,6 +967,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array of all initialized tables
|
||||
*
|
||||
@ -932,6 +977,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->tables;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an iterator that iterators through all
|
||||
* initialized table objects
|
||||
@ -948,6 +994,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return new ArrayIterator($this->tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the count of initialized table objects
|
||||
*
|
||||
@ -957,6 +1004,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* addTable
|
||||
* adds a Doctrine_Table object into connection registry
|
||||
@ -974,6 +1022,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
$this->tables[$name] = $table;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* create
|
||||
* creates a record
|
||||
@ -986,6 +1035,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->getTable($name)->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* flush
|
||||
* saves all the records from all tables
|
||||
@ -1000,6 +1050,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
$this->unitOfWork->saveAll();
|
||||
$this->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* clear
|
||||
* clears all repositories
|
||||
@ -1013,6 +1064,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
$table->clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* evictTables
|
||||
* evicts all tables
|
||||
@ -1024,6 +1076,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
$this->tables = array();
|
||||
$this->exported = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* close
|
||||
* closes the connection
|
||||
@ -1043,6 +1096,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
$this->getAttribute(Doctrine::ATTR_LISTENER)->postClose($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current transaction nesting level
|
||||
*
|
||||
@ -1052,6 +1106,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->transaction->getTransactionLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* errorCode
|
||||
* Fetch the SQLSTATE associated with the last operation on the database handle
|
||||
@ -1064,6 +1119,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $this->dbh->errorCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* errorInfo
|
||||
* Fetch extended error information associated with the last operation on the database handle
|
||||
@ -1076,6 +1132,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
|
||||
return $this->dbh->errorInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* lastInsertId
|
||||
*
|
||||
@ -1092,6 +1149,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
return $this->sequence->lastInsertId($table, $field);
|
||||
}
|
||||
|
||||
/**
|
||||
* beginTransaction
|
||||
* Start a transaction or set a savepoint.
|
||||
@ -1109,6 +1167,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
$this->transaction->beginTransaction($savepoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* commit
|
||||
* Commit the database changes done during a transaction that is in
|
||||
@ -1126,6 +1185,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
{
|
||||
$this->transaction->commit($savepoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* rollback
|
||||
* Cancel any database changes done during a transaction or since a specific
|
||||
|
@ -69,12 +69,14 @@ class Doctrine_Connection_Exception extends Doctrine_Exception
|
||||
Doctrine::ERR_TRUNCATED => 'truncated',
|
||||
Doctrine::ERR_DEADLOCK => 'deadlock detected',
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Doctrine::ERR_* constants
|
||||
* @since 1.0
|
||||
* @var integer $portableCode portable error code
|
||||
*/
|
||||
protected $portableCode;
|
||||
|
||||
/**
|
||||
* getPortableCode
|
||||
* returns portable error code
|
||||
@ -85,6 +87,7 @@ class Doctrine_Connection_Exception extends Doctrine_Exception
|
||||
{
|
||||
return $this->portableCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* getPortableMessage
|
||||
* returns portable error message
|
||||
@ -95,6 +98,7 @@ class Doctrine_Connection_Exception extends Doctrine_Exception
|
||||
{
|
||||
return self::errorMessage($this->portableCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a textual error message for a Doctrine error code
|
||||
*
|
||||
|
@ -38,6 +38,7 @@ class Doctrine_Connection_Firebird extends Doctrine_Connection
|
||||
* @var string $driverName the name of this connection driver
|
||||
*/
|
||||
protected $driverName = 'Firebird';
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*
|
||||
@ -77,6 +78,7 @@ class Doctrine_Connection_Firebird extends Doctrine_Connection
|
||||
*/
|
||||
parent::__construct($manager, $adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charset on the current connection
|
||||
*
|
||||
@ -89,6 +91,7 @@ class Doctrine_Connection_Firebird extends Doctrine_Connection
|
||||
$query = 'SET NAMES '.$this->dbh->quote($charset);
|
||||
$this->exec($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an driver-specific LIMIT clause to the query
|
||||
*
|
||||
|
@ -68,6 +68,7 @@ class Doctrine_Connection_Firebird_Exception extends Doctrine_Connection_Excepti
|
||||
-923 => Doctrine::ERR_CONNECT_FAILED,
|
||||
-924 => Doctrine::ERR_CONNECT_FAILED
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $errorRegexps an array that is used for determining portable
|
||||
* error code from a native database error message
|
||||
@ -96,6 +97,7 @@ class Doctrine_Connection_Firebird_Exception extends Doctrine_Connection_Excepti
|
||||
'/table unknown/i'
|
||||
=> Doctrine::ERR_NOSUCHTABLE,
|
||||
);
|
||||
|
||||
/**
|
||||
* This method checks if native error code/message can be
|
||||
* converted into a portable code and then adds this
|
||||
|
@ -36,6 +36,7 @@ class Doctrine_Connection_Informix extends Doctrine_Connection
|
||||
* @var string $driverName the name of this connection driver
|
||||
*/
|
||||
protected $driverName = 'Informix';
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*
|
||||
|
@ -37,6 +37,7 @@ class Doctrine_Connection_Mock extends Doctrine_Connection_Common
|
||||
* @var string $driverName the name of this connection driver
|
||||
*/
|
||||
protected $driverName = 'Mock';
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Connection_Module
|
||||
*
|
||||
@ -36,10 +37,12 @@ class Doctrine_Connection_Module
|
||||
* module holds an instance of Doctrine_Connection
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* @var string $moduleName the name of this module
|
||||
*/
|
||||
protected $moduleName;
|
||||
|
||||
/**
|
||||
* @param Doctrine_Connection $conn Doctrine_Connection object, every connection
|
||||
* module holds an instance of Doctrine_Connection
|
||||
@ -55,6 +58,7 @@ class Doctrine_Connection_Module
|
||||
|
||||
$this->moduleName = $e[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* getConnection
|
||||
* returns the connection object this module uses
|
||||
@ -65,6 +69,7 @@ class Doctrine_Connection_Module
|
||||
{
|
||||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* getModuleName
|
||||
* returns the name of this module
|
||||
|
@ -37,6 +37,7 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
|
||||
* @var string $driverName the name of this connection driver
|
||||
*/
|
||||
protected $driverName = 'Mssql';
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*
|
||||
@ -66,6 +67,7 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
|
||||
|
||||
parent::__construct($manager, $adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* quoteIdentifier
|
||||
* Quote a string so it can be safely used as a table / column name
|
||||
@ -84,6 +86,7 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
|
||||
}
|
||||
return '[' . str_replace(']', ']]', $identifier) . ']';
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an adapter-specific LIMIT clause to the SELECT statement.
|
||||
* [ borrowed from Zend Framework ]
|
||||
@ -129,6 +132,7 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* return version information about the server
|
||||
*
|
||||
@ -166,6 +170,7 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
|
||||
}
|
||||
return $serverInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if there's a sequence that exists.
|
||||
*
|
||||
|
@ -52,6 +52,7 @@ class Doctrine_Connection_Mssql_Exception extends Doctrine_Connection_Exception
|
||||
3701 => Doctrine::ERR_NOSUCHTABLE,
|
||||
8134 => Doctrine::ERR_DIVZERO,
|
||||
);
|
||||
|
||||
/**
|
||||
* This method checks if native error code/message can be
|
||||
* converted into a portable code and then adds this
|
||||
|
@ -37,6 +37,7 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common
|
||||
* @var string $driverName the name of this connection driver
|
||||
*/
|
||||
protected $driverName = 'Mysql';
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*
|
||||
@ -88,6 +89,7 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common
|
||||
|
||||
parent::__construct($manager, $adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charset on the current connection
|
||||
*
|
||||
@ -100,6 +102,7 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common
|
||||
$query = 'SET NAMES '.$this->dbh->quote($charset);
|
||||
$this->exec($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
|
||||
* query, except that if there is already a row in the table with the same
|
||||
|
@ -62,6 +62,7 @@ class Doctrine_Connection_Mysql_Exception extends Doctrine_Connection_Exception
|
||||
1216 => Doctrine::ERR_CONSTRAINT,
|
||||
1217 => Doctrine::ERR_CONSTRAINT,
|
||||
);
|
||||
|
||||
/**
|
||||
* This method checks if native error code/message can be
|
||||
* converted into a portable code and then adds this
|
||||
|
@ -70,6 +70,7 @@ class Doctrine_Connection_Oracle extends Doctrine_Connection
|
||||
*/
|
||||
parent::__construct($manager, $adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the date/time format
|
||||
*
|
||||
@ -78,6 +79,7 @@ class Doctrine_Connection_Oracle extends Doctrine_Connection
|
||||
{
|
||||
$this->exec('ALTER SESSION SET NLS_DATE_FORMAT = "' . $format . '"');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an driver-specific LIMIT clause to the query
|
||||
*
|
||||
|
@ -57,6 +57,7 @@ class Doctrine_Connection_Oracle_Exception extends Doctrine_Connection_Exception
|
||||
2292 => Doctrine::ERR_CONSTRAINT,
|
||||
2449 => Doctrine::ERR_CONSTRAINT,
|
||||
);
|
||||
|
||||
/**
|
||||
* This method checks if native error code/message can be
|
||||
* converted into a portable code and then adds this
|
||||
|
@ -37,6 +37,7 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
|
||||
* @var string $driverName the name of this connection driver
|
||||
*/
|
||||
protected $driverName = 'Pgsql';
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*
|
||||
@ -77,6 +78,7 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
|
||||
'escape' => '"');
|
||||
parent::__construct($manager, $adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charset on the current connection
|
||||
*
|
||||
@ -89,6 +91,7 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
|
||||
$query = 'SET NAMES '.$this->dbh->quote($charset);
|
||||
$this->exec($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* convertBoolean
|
||||
* some drivers need the boolean values to be converted into integers
|
||||
@ -114,6 +117,7 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes a query string for various DBMS specific reasons
|
||||
*
|
||||
@ -150,6 +154,7 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* return version information about the server
|
||||
*
|
||||
|
@ -80,6 +80,7 @@ class Doctrine_Connection_Pgsql_Exception extends Doctrine_Connection_Exception
|
||||
'/more expressions than target columns/i'
|
||||
=> Doctrine::ERR_VALUE_COUNT_ON_ROW,
|
||||
);
|
||||
|
||||
/**
|
||||
* This method checks if native error code/message can be
|
||||
* converted into a portable code and then adds this
|
||||
|
@ -44,16 +44,19 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
|
||||
'exec',
|
||||
'execute',
|
||||
);
|
||||
|
||||
/**
|
||||
* @param array $events an array containing all listened events
|
||||
*/
|
||||
private $events = array();
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* setFilterQueryType
|
||||
*
|
||||
@ -105,6 +108,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
*
|
||||
@ -118,6 +122,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* getAll
|
||||
* returns all profiled events as an array
|
||||
@ -128,6 +133,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
|
||||
{
|
||||
return $this->events;
|
||||
}
|
||||
|
||||
/**
|
||||
* getIterator
|
||||
* returns an iterator that iterates through the logged events
|
||||
@ -138,6 +144,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
|
||||
{
|
||||
return new ArrayIterator($this->events);
|
||||
}
|
||||
|
||||
/**
|
||||
* count
|
||||
*
|
||||
@ -147,6 +154,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
|
||||
{
|
||||
return count($this->events);
|
||||
}
|
||||
|
||||
/**
|
||||
* pop the last event from the event stack
|
||||
*
|
||||
@ -156,6 +164,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
|
||||
{
|
||||
return array_pop($this->events);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Doctrine_Event object for the last query that was run, regardless if it has
|
||||
* ended or not. If the event has not ended, it's end time will be Null.
|
||||
|
@ -37,6 +37,7 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
|
||||
* @var string $driverName the name of this connection driver
|
||||
*/
|
||||
protected $driverName = 'Sqlite';
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*
|
||||
@ -82,6 +83,7 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
|
||||
$this->dbh->sqliteCreateFunction('now', 'time', 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* initializes database functions missing in sqlite
|
||||
*
|
||||
@ -101,6 +103,7 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
|
||||
$this->dbh->sqliteCreateFunction('md5', 'md5', 1);
|
||||
$this->dbh->sqliteCreateFunction('now', 'time', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* getDatabaseFile
|
||||
*
|
||||
|
@ -51,6 +51,7 @@ class Doctrine_Connection_Sqlite_Exception extends Doctrine_Connection_Exception
|
||||
'/^near ".*": syntax error$/' => Doctrine::ERR_SYNTAX,
|
||||
'/[0-9]+ values for [0-9]+ columns/i' => Doctrine::ERR_VALUE_COUNT_ON_ROW,
|
||||
);
|
||||
|
||||
/**
|
||||
* This method checks if native error code/message can be
|
||||
* converted into a portable code and then adds this
|
||||
|
@ -37,10 +37,12 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
* statement holds an instance of Doctrine_Connection
|
||||
*/
|
||||
protected $_conn;
|
||||
|
||||
/**
|
||||
* @var mixed $_stmt PDOStatement object, boolean false or Doctrine_Adapter_Statement object
|
||||
*/
|
||||
protected $_stmt;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
@ -57,6 +59,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
throw new Doctrine_Exception('Unknown statement object given.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getConnection
|
||||
* returns the connection object this statement uses
|
||||
@ -75,6 +78,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->queryString;
|
||||
}
|
||||
|
||||
/**
|
||||
* bindColumn
|
||||
* Bind a column to a PHP variable
|
||||
@ -95,6 +99,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
return $this->_stmt->bindColumn($column, $param, $type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* bindValue
|
||||
* Binds a value to a corresponding named or question mark
|
||||
@ -117,6 +122,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
return $this->_stmt->bindValue($param, $value, $type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* bindParam
|
||||
* Binds a PHP variable to a corresponding named or question mark placeholder in the
|
||||
@ -152,6 +158,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
return $this->_stmt->bindParam($column, $variable, $type, $length, $driverOptions);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* closeCursor
|
||||
* Closes the cursor, enabling the statement to be executed again.
|
||||
@ -162,6 +169,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->closeCursor();
|
||||
}
|
||||
|
||||
/**
|
||||
* columnCount
|
||||
* Returns the number of columns in the result set
|
||||
@ -174,6 +182,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->columnCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* errorCode
|
||||
* Fetch the SQLSTATE associated with the last operation on the statement handle
|
||||
@ -185,6 +194,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->errorCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* errorInfo
|
||||
* Fetch extended error information associated with the last operation on the statement handle
|
||||
@ -196,6 +206,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->errorInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* execute
|
||||
* Executes a prepared statement
|
||||
@ -234,6 +245,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch
|
||||
*
|
||||
@ -281,6 +293,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchAll
|
||||
* Returns an array containing all of the result set rows
|
||||
@ -317,6 +330,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchColumn
|
||||
* Returns a single column from the next row of a
|
||||
@ -332,6 +346,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->fetchColumn($columnIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchObject
|
||||
* Fetches the next row and returns it as an object.
|
||||
@ -349,6 +364,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->fetchObject($className, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* getAttribute
|
||||
* Retrieve a statement attribute
|
||||
@ -361,6 +377,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->getAttribute($attribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* getColumnMeta
|
||||
* Returns metadata for a column in a result set
|
||||
@ -381,6 +398,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->getColumnMeta($column);
|
||||
}
|
||||
|
||||
/**
|
||||
* nextRowset
|
||||
* Advances to the next rowset in a multi-rowset statement handle
|
||||
@ -396,6 +414,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->nextRowset();
|
||||
}
|
||||
|
||||
/**
|
||||
* rowCount
|
||||
* rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
|
||||
@ -412,6 +431,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->rowCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* setAttribute
|
||||
* Set a statement attribute
|
||||
@ -424,6 +444,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
|
||||
{
|
||||
return $this->_stmt->setAttribute($attribute, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* setFetchMode
|
||||
* Set the default fetch mode for this statement
|
||||
|
@ -131,6 +131,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
}
|
||||
return array_values($tree);
|
||||
}
|
||||
|
||||
/**
|
||||
* saves the given record
|
||||
*
|
||||
@ -210,6 +211,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* saves the given record
|
||||
*
|
||||
@ -244,6 +246,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
|
||||
$record->postSave($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes given record and all the related composites
|
||||
* this operation is isolated by a transaction
|
||||
@ -310,6 +313,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
|
||||
return $this->conn->exec($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* deleteMultiple
|
||||
* deletes all records from the pending delete list
|
||||
@ -362,6 +366,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* saveRelated
|
||||
* saves all related records to $record
|
||||
@ -401,6 +406,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
|
||||
return $saveLater;
|
||||
}
|
||||
|
||||
/**
|
||||
* saveAssociations
|
||||
*
|
||||
@ -443,6 +449,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes all related composites
|
||||
* this method is always called internally when a record is deleted
|
||||
@ -464,6 +471,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* saveAll
|
||||
* persists all the pending records from all tables
|
||||
@ -494,6 +502,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update
|
||||
* updates the given record
|
||||
@ -560,6 +569,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* inserts a record into database
|
||||
*
|
||||
|
@ -22,7 +22,8 @@
|
||||
/**
|
||||
* Doctrine_Data
|
||||
*
|
||||
* Base Doctrine_Data class
|
||||
* Base Doctrine_Data class for dumping and loading data to and from fixtures files.
|
||||
* Support formats are based on what formats are available in Doctrine_Parser such as yaml, xml, json, etc.
|
||||
*
|
||||
* @package Doctrine
|
||||
* @subpackage Data
|
||||
@ -42,6 +43,7 @@ class Doctrine_Data
|
||||
* @var string
|
||||
*/
|
||||
public $formats = array('csv', 'yml', 'xml');
|
||||
|
||||
/**
|
||||
* format
|
||||
*
|
||||
@ -50,6 +52,7 @@ class Doctrine_Data
|
||||
* @var string
|
||||
*/
|
||||
public $format = 'yml';
|
||||
|
||||
/**
|
||||
* directory
|
||||
*
|
||||
@ -58,6 +61,7 @@ class Doctrine_Data
|
||||
* @var string
|
||||
*/
|
||||
public $directory = null;
|
||||
|
||||
/**
|
||||
* models
|
||||
*
|
||||
@ -66,6 +70,7 @@ class Doctrine_Data
|
||||
* @var string
|
||||
*/
|
||||
public $models = array();
|
||||
|
||||
/**
|
||||
* exportIndividualFiles
|
||||
*
|
||||
@ -74,6 +79,7 @@ class Doctrine_Data
|
||||
* @var string
|
||||
*/
|
||||
public $exportIndividualFiles = false;
|
||||
|
||||
/**
|
||||
* setFormat
|
||||
*
|
||||
@ -81,58 +87,60 @@ class Doctrine_Data
|
||||
*
|
||||
* @param string $format
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function setFormat($format)
|
||||
{
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* getFormat
|
||||
*
|
||||
* Get the current format we are working with
|
||||
*
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function getFormat()
|
||||
{
|
||||
return $this->format;
|
||||
}
|
||||
|
||||
/**
|
||||
* getFormats
|
||||
*
|
||||
* Get array of available formats
|
||||
*
|
||||
* @author Jonathan H. Wage
|
||||
* @return void
|
||||
*/
|
||||
public function getFormats()
|
||||
{
|
||||
return $this->formats;
|
||||
}
|
||||
|
||||
/**
|
||||
* setDirectory
|
||||
*
|
||||
* Set the array/string of directories or yml file paths
|
||||
*
|
||||
* @author Jonathan H. Wage
|
||||
* @return void
|
||||
*/
|
||||
public function setDirectory($directory)
|
||||
{
|
||||
$this->directory = $directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* getDirectory
|
||||
*
|
||||
* Get directory to work with
|
||||
* Get directory for dumping/loading data from and to
|
||||
*
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function getDirectory()
|
||||
{
|
||||
return $this->directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* setModels
|
||||
*
|
||||
@ -140,30 +148,30 @@ class Doctrine_Data
|
||||
*
|
||||
* @param string $models
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function setModels($models)
|
||||
{
|
||||
$this->models = $models;
|
||||
}
|
||||
|
||||
/**
|
||||
* getModels
|
||||
*
|
||||
* Get the array of specified models to work with
|
||||
*
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function getModels()
|
||||
{
|
||||
return $this->models;
|
||||
}
|
||||
|
||||
/**
|
||||
* exportIndividualFiles
|
||||
*
|
||||
* Set/Get whether or not to export individual files
|
||||
*
|
||||
* @author Jonathan H. Wage
|
||||
* @return bool $exportIndividualFiles
|
||||
*/
|
||||
public function exportIndividualFiles($bool = null)
|
||||
{
|
||||
@ -173,6 +181,7 @@ class Doctrine_Data
|
||||
|
||||
return $this->exportIndividualFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* exportData
|
||||
*
|
||||
@ -183,7 +192,6 @@ class Doctrine_Data
|
||||
* @param string $models
|
||||
* @param string $exportIndividualFiles
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function exportData($directory, $format = 'yml', $models = array(), $exportIndividualFiles = false)
|
||||
{
|
||||
@ -194,6 +202,7 @@ class Doctrine_Data
|
||||
|
||||
return $export->doExport();
|
||||
}
|
||||
|
||||
/**
|
||||
* importData
|
||||
*
|
||||
@ -203,7 +212,6 @@ class Doctrine_Data
|
||||
* @param string $format
|
||||
* @param string $models
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function importData($directory, $format = 'yml', $models = array())
|
||||
{
|
||||
@ -213,6 +221,7 @@ class Doctrine_Data
|
||||
|
||||
return $import->doImport();
|
||||
}
|
||||
|
||||
/**
|
||||
* importDummyData
|
||||
*
|
||||
@ -221,7 +230,6 @@ class Doctrine_Data
|
||||
* @param string $num
|
||||
* @param string $models
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function importDummyData($num = 3, $models = array())
|
||||
{
|
||||
@ -230,6 +238,7 @@ class Doctrine_Data
|
||||
|
||||
return $import->doImportDummyData($num);
|
||||
}
|
||||
|
||||
/**
|
||||
* isRelation
|
||||
*
|
||||
@ -254,7 +263,7 @@ class Doctrine_Data
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* purge
|
||||
*
|
||||
@ -272,6 +281,6 @@ class Doctrine_Data
|
||||
$model = new $model();
|
||||
|
||||
$model->getTable()->createQuery()->delete($model)->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -37,17 +37,16 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
*
|
||||
* @param string $directory
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function __construct($directory)
|
||||
{
|
||||
$this->setDirectory($directory);
|
||||
}
|
||||
|
||||
/**
|
||||
* doExport
|
||||
*
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function doExport()
|
||||
{
|
||||
@ -58,15 +57,14 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
|
||||
$outputAll = true;
|
||||
|
||||
// for situation when the $models array is empty, but the $specifiedModels array isn't
|
||||
if (empty($models))
|
||||
{
|
||||
// for situation when the $models array is empty, but the $specifiedModels array isn't
|
||||
if (empty($models)) {
|
||||
$models = $specifiedModels;
|
||||
}
|
||||
|
||||
foreach ($models AS $name) {
|
||||
|
||||
if (!empty($specifiedModels) AND !in_array($name, $specifiedModels)) {
|
||||
if ( ! empty($specifiedModels) AND !in_array($name, $specifiedModels)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -74,7 +72,7 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
$table = $class->getTable();
|
||||
$result = $table->findAll();
|
||||
|
||||
if (!empty($result)) {
|
||||
if ( ! empty($result)) {
|
||||
$data[$name] = $result;
|
||||
}
|
||||
}
|
||||
@ -83,6 +81,7 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
|
||||
return $this->dumpData($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* dumpData
|
||||
*
|
||||
@ -90,7 +89,6 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
*
|
||||
* @param string $array
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function dumpData(array $data)
|
||||
{
|
||||
@ -101,12 +99,12 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
|
||||
if (is_array($directory)) {
|
||||
throw new Doctrine_Data_Exception('You must specify a single path to a folder in order to export individual files.');
|
||||
} else if (!is_dir($directory) && is_file($directory)) {
|
||||
} else if ( ! is_dir($directory) && is_file($directory)) {
|
||||
$directory = dirname($directory);
|
||||
}
|
||||
|
||||
foreach ($data as $className => $classData) {
|
||||
if (!empty($classData)) {
|
||||
if ( ! empty($classData)) {
|
||||
Doctrine_Parser::dump(array($className => $classData), $format, $directory.DIRECTORY_SEPARATOR.$className.'.'.$format);
|
||||
}
|
||||
}
|
||||
@ -115,11 +113,12 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
throw new Doctrine_Data_Exception('You must specify the path to a '.$format.' file to export. You specified a directory.');
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
if ( ! empty($data)) {
|
||||
return Doctrine_Parser::dump($data, $format, $directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* prepareData
|
||||
*
|
||||
@ -127,7 +126,6 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
*
|
||||
* @param string $data
|
||||
* @return array
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function prepareData($data)
|
||||
{
|
||||
@ -142,14 +140,14 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
$recordData = $record->toArray();
|
||||
|
||||
foreach ($recordData as $key => $value) {
|
||||
if (!$value) {
|
||||
if ( ! $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip single primary keys, we need to maintain composite primary keys
|
||||
$keys = $record->getTable()->getIdentifier();
|
||||
|
||||
if (!is_array($keys)) {
|
||||
if ( ! is_array($keys)) {
|
||||
$keys = array($keys);
|
||||
}
|
||||
|
||||
|
@ -37,20 +37,18 @@ class Doctrine_Data_Import extends Doctrine_Data
|
||||
*
|
||||
* @param string $directory
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
|
||||
public function __construct($directory = null)
|
||||
{
|
||||
if ($directory !== null) {
|
||||
$this->setDirectory($directory);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* doImport
|
||||
*
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function doImport()
|
||||
{
|
||||
@ -82,12 +80,12 @@ class Doctrine_Data_Import extends Doctrine_Data
|
||||
|
||||
$this->loadData($array);
|
||||
}
|
||||
|
||||
/**
|
||||
* loadData
|
||||
*
|
||||
* @param string $array
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
protected function loadData(array $array)
|
||||
{
|
||||
@ -99,7 +97,7 @@ class Doctrine_Data_Import extends Doctrine_Data
|
||||
|
||||
foreach ($array as $className => $data) {
|
||||
|
||||
if (!empty($specifiedModels) && !in_array($className, $specifiedModels)) {
|
||||
if ( ! empty($specifiedModels) && !in_array($className, $specifiedModels)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -149,12 +147,12 @@ class Doctrine_Data_Import extends Doctrine_Data
|
||||
$obj->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* doImportDummyData
|
||||
*
|
||||
* @param string $num
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public function doImportDummyData($num = 3)
|
||||
{
|
||||
@ -163,7 +161,7 @@ class Doctrine_Data_Import extends Doctrine_Data
|
||||
$specifiedModels = $this->getModels();
|
||||
|
||||
foreach ($models as $name) {
|
||||
if (!empty($specifiedModels) && !in_array($name, $specifiedModels)) {
|
||||
if ( ! empty($specifiedModels) && !in_array($name, $specifiedModels)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -181,18 +179,24 @@ class Doctrine_Data_Import extends Doctrine_Data
|
||||
|
||||
public function populateDummyRecord(Doctrine_Record $record)
|
||||
{
|
||||
$lorem = explode(' ', "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.");
|
||||
$lorem = explode(' ', "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
|
||||
Ipsum has been the industry's standard dummy text ever since the 1500s, when an
|
||||
unknown printer took a galley of type and scrambled it to make a type specimen book.
|
||||
It has survived not only five centuries, but also the leap into electronic
|
||||
typesetting, remaining essentially unchanged. It was popularised in the 1960s with
|
||||
the release of Letraset sheets containing Lorem Ipsum passages, and more recently
|
||||
with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.");
|
||||
|
||||
$columns = array_keys($record->toArray());
|
||||
$pks = $record->getTable()->getIdentifier();
|
||||
|
||||
if (!is_array($pks)) {
|
||||
if ( ! is_array($pks)) {
|
||||
$pks = array($pks);
|
||||
}
|
||||
|
||||
foreach ($columns as $column) {
|
||||
|
||||
if (!in_array($column, $pks)) {
|
||||
if ( ! in_array($column, $pks)) {
|
||||
if ($relation = $this->isRelation($record, $column)) {
|
||||
$alias = $relation['alias'];
|
||||
$relationObj = $record->$alias;
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_DataDict
|
||||
*
|
||||
@ -73,6 +74,7 @@ class Doctrine_DataDict extends Doctrine_Connection_Module
|
||||
|
||||
return $change;
|
||||
}
|
||||
|
||||
/**
|
||||
* parseBoolean
|
||||
* parses a literal boolean value and returns
|
||||
|
@ -99,6 +99,7 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
|
||||
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a native array description of a field to a Doctrine datatype and length
|
||||
*
|
||||
@ -188,6 +189,7 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
|
||||
'unsigned' => $unsigned,
|
||||
'fixed' => $fixed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the CHARACTER SET
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
@ -200,6 +202,7 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
|
||||
{
|
||||
return 'CHARACTER SET ' . $charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the COLLATION
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
|
@ -114,6 +114,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
|
||||
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a native array description of a field to a MDB2 datatype and length
|
||||
*
|
||||
|
@ -228,6 +228,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
|
||||
}
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a native array description of a field to a MDB2 datatype and length
|
||||
*
|
||||
@ -386,6 +387,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
|
||||
return array('type' => $type, 'length' => $length, 'unsigned' => $unsigned, 'fixed' => $fixed, 'values' => $values);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the CHARACTER SET
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
@ -398,6 +400,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
|
||||
{
|
||||
return 'CHARACTER SET ' . $charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the COLLATION
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
@ -410,6 +413,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
|
||||
{
|
||||
return 'COLLATE ' . $collation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to declare an integer type
|
||||
* field to be used in statements like CREATE TABLE.
|
||||
|
@ -97,6 +97,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
|
||||
}
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a native array description of a field to a doctrine datatype and length
|
||||
*
|
||||
|
@ -422,6 +422,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
|
||||
}
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a native array description of a field to a portable Doctrine datatype and length
|
||||
*
|
||||
@ -553,6 +554,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
|
||||
'unsigned' => $unsigned,
|
||||
'fixed' => $fixed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to declare an integer type
|
||||
* field to be used in statements like CREATE TABLE.
|
||||
@ -606,6 +608,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
|
||||
$name = $this->conn->quoteIdentifier($name, true);
|
||||
return $name . ' ' . $this->getNativeDeclaration($field) . $default . $notnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* parseBoolean
|
||||
* parses a literal boolean value and returns
|
||||
|
@ -119,6 +119,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
|
||||
}
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a native array description of a field to Doctrine datatype and length
|
||||
*
|
||||
@ -240,6 +241,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
|
||||
'unsigned' => $unsigned,
|
||||
'fixed' => $fixed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to declare an integer type
|
||||
* field to be used in statements like CREATE TABLE.
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Db
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Event
|
||||
*
|
||||
@ -63,35 +64,43 @@ class Doctrine_Event
|
||||
const RECORD_INSERT = 24;
|
||||
const RECORD_SERIALIZE = 25;
|
||||
const RECORD_UNSERIALIZE = 26;
|
||||
|
||||
/**
|
||||
* @var mixed $_invoker the handler which invoked this event
|
||||
*/
|
||||
protected $_invoker;
|
||||
|
||||
/**
|
||||
* @var string $_query the sql query associated with this event (if any)
|
||||
*/
|
||||
protected $_query;
|
||||
|
||||
/**
|
||||
* @var string $_params the parameters associated with the query (if any)
|
||||
*/
|
||||
protected $_params;
|
||||
|
||||
/**
|
||||
* @see Doctrine_Event constants
|
||||
* @var integer $_code the event code
|
||||
*/
|
||||
protected $_code;
|
||||
|
||||
/**
|
||||
* @var integer $_startedMicrotime the time point in which this event was started
|
||||
*/
|
||||
protected $_startedMicrotime;
|
||||
|
||||
/**
|
||||
* @var integer $_endedMicrotime the time point in which this event was ended
|
||||
*/
|
||||
protected $_endedMicrotime;
|
||||
|
||||
/**
|
||||
* @var array $_options an array of options
|
||||
*/
|
||||
protected $_options = array();
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
@ -107,6 +116,7 @@ class Doctrine_Event
|
||||
$this->_query = $query;
|
||||
$this->_params = $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* getQuery
|
||||
*
|
||||
@ -116,6 +126,7 @@ class Doctrine_Event
|
||||
{
|
||||
return $this->_query;
|
||||
}
|
||||
|
||||
/**
|
||||
* getName
|
||||
* returns the name of this event
|
||||
@ -173,6 +184,7 @@ class Doctrine_Event
|
||||
return 'unserialize record';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getCode
|
||||
*
|
||||
@ -182,6 +194,7 @@ class Doctrine_Event
|
||||
{
|
||||
return $this->_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* getOption
|
||||
* returns the value of an option
|
||||
@ -197,6 +210,7 @@ class Doctrine_Event
|
||||
|
||||
return $this->_options[$option];
|
||||
}
|
||||
|
||||
/**
|
||||
* skipOperation
|
||||
* skips the next operation
|
||||
@ -210,6 +224,7 @@ class Doctrine_Event
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* setOption
|
||||
* sets the value of an option
|
||||
@ -224,6 +239,7 @@ class Doctrine_Event
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* setOption
|
||||
* sets the value of an option by reference
|
||||
@ -238,6 +254,7 @@ class Doctrine_Event
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* start
|
||||
* starts the internal timer of this event
|
||||
@ -248,6 +265,7 @@ class Doctrine_Event
|
||||
{
|
||||
$this->_startedMicrotime = microtime(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* hasEnded
|
||||
* whether or not this event has ended
|
||||
@ -258,6 +276,7 @@ class Doctrine_Event
|
||||
{
|
||||
return ($this->_endedMicrotime != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* end
|
||||
* ends the internal timer of this event
|
||||
@ -270,6 +289,7 @@ class Doctrine_Event
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* getInvoker
|
||||
* returns the handler that invoked this event
|
||||
@ -281,6 +301,7 @@ class Doctrine_Event
|
||||
{
|
||||
return $this->_invoker;
|
||||
}
|
||||
|
||||
/**
|
||||
* getParams
|
||||
* returns the parameters of the query
|
||||
@ -291,6 +312,7 @@ class Doctrine_Event
|
||||
{
|
||||
return $this->_params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the elapsed time (in microseconds) that the event ran. If the event has
|
||||
* not yet ended, return false.
|
||||
|
@ -39,6 +39,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
* @var array $listeners an array containing all listeners
|
||||
*/
|
||||
protected $_listeners = array();
|
||||
|
||||
/**
|
||||
* add
|
||||
* adds a listener to the chain of listeners
|
||||
@ -60,6 +61,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$this->_listeners[$name] = $listener;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a Doctrine_EventListener on success
|
||||
* and null on failure
|
||||
@ -74,6 +76,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
}
|
||||
return $this->_listeners[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* set
|
||||
*
|
||||
@ -85,6 +88,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
{
|
||||
$this->_listeners[$key] = $listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* onLoad
|
||||
* an event invoked when Doctrine_Record is being loaded from database
|
||||
@ -98,6 +102,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->onLoad($record);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onPreLoad
|
||||
* an event invoked when Doctrine_Record is being loaded
|
||||
@ -112,6 +117,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->onPreLoad($record);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onSleep
|
||||
* an event invoked when Doctrine_Record is serialized
|
||||
@ -125,6 +131,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->onSleep($record);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onWakeUp
|
||||
* an event invoked when Doctrine_Record is unserialized
|
||||
@ -138,6 +145,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->onWakeUp($record);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* postClose
|
||||
* an event invoked after Doctrine_Connection is closed
|
||||
@ -151,6 +159,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->postClose($event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* preClose
|
||||
* an event invoked before Doctrine_Connection is closed
|
||||
@ -164,6 +173,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->preClose($event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onOpen
|
||||
* an event invoked after Doctrine_Connection is opened
|
||||
@ -177,6 +187,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->onOpen($connection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onTransactionCommit
|
||||
* an event invoked after a Doctrine_Connection transaction is committed
|
||||
@ -190,6 +201,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->postTransactionCommit($event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onPreTransactionCommit
|
||||
* an event invoked before a Doctrine_Connection transaction is committed
|
||||
@ -203,6 +215,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->preTransactionCommit($event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onTransactionRollback
|
||||
* an event invoked after a Doctrine_Connection transaction is being rolled back
|
||||
@ -216,6 +229,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->postTransactionRollback($event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onPreTransactionRollback
|
||||
* an event invoked before a Doctrine_Connection transaction is being rolled back
|
||||
@ -229,6 +243,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->preTransactionRollback($event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onTransactionBegin
|
||||
* an event invoked after a Doctrine_Connection transaction has been started
|
||||
@ -242,6 +257,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->postTransactionBegin($event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onTransactionBegin
|
||||
* an event invoked before a Doctrine_Connection transaction is being started
|
||||
@ -255,6 +271,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->preTransactionBegin($event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onCollectionDelete
|
||||
* an event invoked after a Doctrine_Collection is being deleted
|
||||
@ -268,6 +285,7 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
|
||||
$listener->onCollectionDelete($collection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onCollectionDelete
|
||||
* an event invoked after a Doctrine_Collection is being deleted
|
||||
|
@ -18,6 +18,7 @@
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Doctrine_Exception
|
||||
*
|
||||
@ -68,6 +69,7 @@ class Doctrine_Exception extends Exception
|
||||
Doctrine::ERR_TRUNCATED => 'truncated',
|
||||
Doctrine::ERR_DEADLOCK => 'deadlock detected',
|
||||
);
|
||||
|
||||
/**
|
||||
* Return a textual error message for a Doctrine error code
|
||||
*
|
||||
|
@ -58,6 +58,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
$this->conn->execute($this->dropDatabaseSql($database));
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing database
|
||||
* (this method is implemented by the drivers)
|
||||
@ -69,6 +70,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
throw new Doctrine_Export_Exception('Drop database not supported by this driver.');
|
||||
}
|
||||
|
||||
/**
|
||||
* dropTableSql
|
||||
* drop an existing table
|
||||
@ -80,6 +82,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
return 'DROP TABLE ' . $this->conn->quoteIdentifier($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* dropTable
|
||||
* drop an existing table
|
||||
@ -117,6 +120,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return 'DROP INDEX ' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop existing constraint
|
||||
*
|
||||
@ -132,6 +136,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $this->conn->exec('ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* drop existing foreign key
|
||||
*
|
||||
@ -143,6 +148,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
return $this->dropConstraint($table, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* dropSequenceSql
|
||||
* drop existing sequence
|
||||
@ -156,6 +162,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
$this->conn->exec($this->dropSequenceSql($sequenceName));
|
||||
}
|
||||
|
||||
/**
|
||||
* dropSequenceSql
|
||||
* drop existing sequence
|
||||
@ -168,6 +175,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
throw new Doctrine_Export_Exception('Drop sequence not supported by this driver.');
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new database
|
||||
* (this method is implemented by the drivers)
|
||||
@ -179,6 +187,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
$this->conn->execute($this->createDatabaseSql($database));
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new database
|
||||
* (this method is implemented by the drivers)
|
||||
@ -190,6 +199,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
throw new Doctrine_Export_Exception('Create database not supported by this driver.');
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new table
|
||||
*
|
||||
@ -265,6 +275,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new table
|
||||
*
|
||||
@ -283,6 +294,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
$this->conn->execute($query);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create sequence
|
||||
*
|
||||
@ -301,6 +313,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
return $this->conn->execute($this->createSequenceSql($seqName, $start = 1, $options));
|
||||
}
|
||||
|
||||
/**
|
||||
* return RDBMS specific create sequence statement
|
||||
* (this method is implemented by the drivers)
|
||||
@ -320,6 +333,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
throw new Doctrine_Export_Exception('Create sequence not supported by this driver.');
|
||||
}
|
||||
|
||||
/**
|
||||
* create a constraint on a table
|
||||
*
|
||||
@ -347,6 +361,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $this->conn->exec($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a constraint on a table
|
||||
*
|
||||
@ -388,6 +403,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stucture of a field into an array
|
||||
*
|
||||
@ -423,6 +439,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
return $this->conn->execute($this->createIndexSql($table, $name, $definition));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stucture of a field into an array
|
||||
*
|
||||
@ -473,6 +490,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* createForeignKey
|
||||
*
|
||||
@ -486,6 +504,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $this->conn->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* alter an existing table
|
||||
* (this method is implemented by the drivers)
|
||||
@ -583,6 +602,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
$this->conn->execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* generates the sql for altering an existing table
|
||||
* (this method is implemented by the drivers)
|
||||
@ -599,6 +619,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
throw new Doctrine_Export_Exception('Alter table not supported by this driver.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get declaration of a number of field in bulk
|
||||
*
|
||||
@ -637,6 +658,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
}
|
||||
return implode(', ', $queryFields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to declare a generic type
|
||||
* field to be used in statements like CREATE TABLE.
|
||||
@ -697,6 +719,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
}
|
||||
return $this->conn->quoteIdentifier($name, true) . ' ' . $dec . $charset . $default . $notnull . $unique . $check . $collation;
|
||||
}
|
||||
|
||||
/**
|
||||
* getDefaultDeclaration
|
||||
* Obtain DBMS specific SQL code portion needed to set a default value
|
||||
@ -726,6 +749,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set a CHECK constraint
|
||||
* declaration to be used in statements like CREATE TABLE.
|
||||
@ -752,6 +776,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return implode(', ', $constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set an index
|
||||
* declaration to be used in statements like CREATE TABLE.
|
||||
@ -783,6 +808,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* getIndexFieldDeclarationList
|
||||
* Obtain DBMS specific SQL code portion needed to set an index
|
||||
@ -802,6 +828,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
}
|
||||
return implode(', ', $ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to return the required SQL string that fits between CREATE ... TABLE
|
||||
* to create the table as a temporary table.
|
||||
@ -820,6 +847,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
return 'TEMPORARY';
|
||||
}
|
||||
|
||||
/**
|
||||
* getForeignKeyDeclaration
|
||||
* Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
|
||||
@ -869,6 +897,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* getAdvancedForeignKeyOptions
|
||||
* Return the FOREIGN KEY query section dealing with non-standard options
|
||||
@ -888,6 +917,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* getForeignKeyReferentialAction
|
||||
*
|
||||
@ -913,6 +943,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
throw new Doctrine_Export_Exception('Unknown foreign key referential action \'' . $upper . '\' given.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getForeignKeyBaseDeclaration
|
||||
* Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
|
||||
@ -953,6 +984,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the UNIQUE constraint
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
@ -964,6 +996,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
return 'UNIQUE';
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the CHARACTER SET
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
@ -976,6 +1009,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the COLLATION
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
@ -988,6 +1022,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* exportSchema
|
||||
* method for exporting Doctrine_Record classes to a schema
|
||||
@ -1013,6 +1048,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
$this->exportClasses($models);
|
||||
}
|
||||
|
||||
/**
|
||||
* exportClasses
|
||||
* method for exporting Doctrine_Record classes to a schema
|
||||
@ -1030,7 +1066,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
$connection = $record->getTable()->getConnection();
|
||||
$connectionName = Doctrine_Manager::getInstance()->getConnectionName($connection);
|
||||
|
||||
if (!isset($connections[$connectionName])) {
|
||||
if ( ! isset($connections[$connectionName])) {
|
||||
$connections[$connectionName] = array();
|
||||
$connections[$connectionName]['creates'] = array();
|
||||
$connections[$connectionName]['alters'] = array();
|
||||
@ -1075,6 +1111,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
$connection->commit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* exportClassesSql
|
||||
* method for exporting Doctrine_Record classes to a schema
|
||||
@ -1115,6 +1152,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* exportPluginsSql
|
||||
* exports plugin tables for given table
|
||||
@ -1147,6 +1185,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* exportSql
|
||||
* returns the sql for exporting Doctrine_Record classes to a schema
|
||||
@ -1172,6 +1211,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
return $this->exportClassesSql($models);
|
||||
}
|
||||
|
||||
/**
|
||||
* exportTable
|
||||
* exports given table into database based on column and option definitions
|
||||
|
@ -46,6 +46,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
'PHP Interbase API does not support direct queries. You have to ' .
|
||||
'create the db manually by using isql command or a similar program');
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing database
|
||||
*
|
||||
@ -58,6 +59,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
'PHP Interbase API does not support direct queries. You have ' .
|
||||
'to drop the db manually by using isql command or a similar program');
|
||||
}
|
||||
|
||||
/**
|
||||
* add an autoincrement sequence + trigger
|
||||
*
|
||||
@ -99,6 +101,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing autoincrement sequence + trigger
|
||||
*
|
||||
@ -116,6 +119,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
|
||||
return $this->conn->exec("DELETE FROM RDB\$TRIGGERS WHERE UPPER(RDB\$RELATION_NAME)=" . $table . " AND UPPER(RDB\$TRIGGER_NAME)=" . $triggerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new table
|
||||
*
|
||||
@ -167,6 +171,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if planned changes are supported
|
||||
*
|
||||
@ -196,6 +201,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing table
|
||||
*
|
||||
@ -212,6 +218,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* alter an existing table
|
||||
*
|
||||
@ -372,6 +379,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
$this->_silentCommit();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stucture of a field into an array
|
||||
*
|
||||
@ -431,6 +439,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* create a constraint on a table
|
||||
*
|
||||
@ -480,6 +489,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
// TODO ? $this->_silentCommit();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to return the required SQL string that fits between CREATE ... TABLE
|
||||
* to create the table as a temporary table.
|
||||
@ -491,6 +501,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
{
|
||||
return 'GLOBAL TEMPORARY';
|
||||
}
|
||||
|
||||
/**
|
||||
* create sequence
|
||||
*
|
||||
@ -523,6 +534,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
||||
}
|
||||
throw new Doctrine_Export_Exception('could not create sequence table');
|
||||
}
|
||||
|
||||
/**
|
||||
* drop existing sequence
|
||||
*
|
||||
|
@ -44,6 +44,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
|
||||
$name = $this->conn->quoteIdentifier($name, true);
|
||||
return 'CREATE DATABASE ' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing database
|
||||
*
|
||||
@ -55,6 +56,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
|
||||
$name = $this->conn->quoteIdentifier($name, true);
|
||||
return 'DELETE DATABASE ' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing table
|
||||
*
|
||||
@ -67,6 +69,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
|
||||
$name = $this->conn->quoteIdentifier($name, true);
|
||||
return 'DROP TABLE ' . $name . ' CASCADE';
|
||||
}
|
||||
|
||||
/**
|
||||
* alter an existing table
|
||||
*
|
||||
@ -242,6 +245,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
|
||||
$name = $this->conn->quoteIdentifier($name, true);
|
||||
return $this->conn->exec('ALTER TABLE ' . $name . ' ' . $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* create sequence
|
||||
*
|
||||
@ -281,6 +285,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
|
||||
throw new Doctrine_Export_Exception('could not create sequence table');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* drop existing sequence
|
||||
*
|
||||
@ -293,6 +298,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
|
||||
|
||||
return 'DROP TABLE ' . $sequenceName . ' CASCADE';
|
||||
}
|
||||
|
||||
/**
|
||||
* drop existing index
|
||||
*
|
||||
|
@ -51,6 +51,7 @@ class Doctrine_Export_Mssql extends Doctrine_Export
|
||||
}
|
||||
return $this->conn->standaloneQuery($query, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing database
|
||||
*
|
||||
@ -204,6 +205,7 @@ class Doctrine_Export_Mssql extends Doctrine_Export
|
||||
$name = $this->conn->quoteIdentifier($name, true);
|
||||
return $this->conn->exec('ALTER TABLE ' . $name . ' ' . $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* create sequence
|
||||
*
|
||||
@ -239,6 +241,7 @@ class Doctrine_Export_Mssql extends Doctrine_Export
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function drops an existing sequence
|
||||
*
|
||||
|
@ -43,6 +43,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
{
|
||||
return 'CREATE DATABASE ' . $this->conn->quoteIdentifier($name, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing database
|
||||
*
|
||||
@ -53,6 +54,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
{
|
||||
return 'DROP DATABASE ' . $this->conn->quoteIdentifier($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new table
|
||||
*
|
||||
@ -181,6 +183,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* alter an existing table
|
||||
*
|
||||
@ -360,6 +363,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
|
||||
return 'ALTER TABLE ' . $name . ' ' . $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* create sequence
|
||||
*
|
||||
@ -434,6 +438,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stucture of a field into an array
|
||||
*
|
||||
@ -489,6 +494,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* getDefaultDeclaration
|
||||
* Obtain DBMS specific SQL code portion needed to set a default value
|
||||
@ -516,6 +522,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set an index
|
||||
* declaration to be used in statements like CREATE TABLE.
|
||||
@ -552,6 +559,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* getIndexFieldDeclarationList
|
||||
* Obtain DBMS specific SQL code portion needed to set an index
|
||||
@ -589,6 +597,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
}
|
||||
return implode(', ', $declFields);
|
||||
}
|
||||
|
||||
/**
|
||||
* getAdvancedForeignKeyOptions
|
||||
* Return the FOREIGN KEY query section dealing with non-standard options
|
||||
@ -611,6 +620,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop existing index
|
||||
*
|
||||
@ -624,6 +634,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
$name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), true);
|
||||
return 'DROP INDEX ' . $name . ' ON ' . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* dropTable
|
||||
*
|
||||
|
@ -64,6 +64,7 @@ class Doctrine_Export_Oracle extends Doctrine_Export
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing database
|
||||
*
|
||||
@ -82,6 +83,7 @@ class Doctrine_Export_Oracle extends Doctrine_Export
|
||||
|
||||
return $this->conn->exec('DROP USER ' . $username . ' CASCADE');
|
||||
}
|
||||
|
||||
/**
|
||||
* add an autoincrement sequence + trigger
|
||||
*
|
||||
@ -140,6 +142,7 @@ END;
|
||||
';
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing autoincrement sequence + trigger
|
||||
*
|
||||
@ -182,6 +185,7 @@ END;
|
||||
{
|
||||
return 'GLOBAL TEMPORARY';
|
||||
}
|
||||
|
||||
/**
|
||||
* getAdvancedForeignKeyOptions
|
||||
* Return the FOREIGN KEY query section dealing with non-standard options
|
||||
@ -296,6 +300,7 @@ END;
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing table
|
||||
*
|
||||
@ -310,6 +315,7 @@ END;
|
||||
//$this->conn->completeNestedTransaction();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* alter an existing table
|
||||
*
|
||||
@ -458,6 +464,7 @@ END;
|
||||
$result = $this->conn->exec('ALTER TABLE ' . $name . ' RENAME TO ' . $changeName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create sequence
|
||||
*
|
||||
@ -478,6 +485,7 @@ END;
|
||||
$query .= ($start < 1 ? ' MINVALUE ' . $start : '');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop existing sequence
|
||||
*
|
||||
|
@ -46,6 +46,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* drop an existing database
|
||||
*
|
||||
@ -59,6 +60,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* getAdvancedForeignKeyOptions
|
||||
* Return the FOREIGN KEY query section dealing with non-standard options
|
||||
@ -252,6 +254,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
|
||||
$this->conn->exec('ALTER TABLE ' . $name . ' RENAME TO ' . $changeName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return RDBMS specific create sequence statement
|
||||
*
|
||||
@ -272,6 +275,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
|
||||
return $this->conn->exec('CREATE SEQUENCE ' . $sequenceName . ' INCREMENT 1' .
|
||||
($start < 1 ? ' MINVALUE ' . $start : '') . ' START ' . $start);
|
||||
}
|
||||
|
||||
/**
|
||||
* drop existing sequence
|
||||
*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user