some minor refactorings. started to make a draft of the new namespaced folder structure.
This commit is contained in:
parent
4ea5c8b0a2
commit
ec5bb2ea3f
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Access
|
* Doctrine_Access
|
||||||
*
|
*
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* and is licensed under the LGPL. For more information, see
|
* and is licensed under the LGPL. For more information, see
|
||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
Doctrine::autoload('Doctrine_EventListener');
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Cache
|
* Doctrine_Cache
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM::Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <tt>ClassMetadata</tt> instance holds all the information (metadata) of an entity and
|
* A <tt>ClassMetadata</tt> instance holds all the information (metadata) of an entity and
|
||||||
* it's associations and how they're mapped to the relational database.
|
* it's associations and how they're mapped to the relational database.
|
||||||
@ -28,7 +30,7 @@
|
|||||||
* @author Roman Borschel <roman@code-factory.org>
|
* @author Roman Borschel <roman@code-factory.org>
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializable
|
class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The name of the entity class that is mapped to the database with this metadata.
|
* The name of the entity class that is mapped to the database with this metadata.
|
||||||
@ -1970,19 +1972,19 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasAttribute($key)
|
public function hasAttribute($name)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
return false;
|
||||||
case Doctrine::ATTR_SEQCOL_NAME:
|
}
|
||||||
case Doctrine::ATTR_COLL_KEY:
|
|
||||||
case Doctrine::ATTR_LOAD_REFERENCES:
|
public function getAttribute($name)
|
||||||
case Doctrine::ATTR_EXPORT:
|
{
|
||||||
case Doctrine::ATTR_QUERY_LIMIT:
|
return null;
|
||||||
case Doctrine::ATTR_VALIDATE:
|
}
|
||||||
return true;
|
|
||||||
default:
|
public function setAttribute($name, $value)
|
||||||
return false;
|
{
|
||||||
}
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A persistent collection of entities.
|
* A persistent collection of entities.
|
||||||
* A collection object is strongly typed in the sense that it can only contain
|
* A collection object is strongly typed in the sense that it can only contain
|
||||||
|
@ -19,428 +19,21 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::Core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Configurable
|
* Doctrine_Configurable
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @package Doctrine
|
|
||||||
* @subpackage Configurable
|
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link www.phpdoctrine.org
|
* @link www.phpdoctrine.org
|
||||||
* @since 1.0
|
* @since 2.0
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||||
|
* @author Roman Borschel <roman@code-factory.org>
|
||||||
*/
|
*/
|
||||||
abstract class Doctrine_Configurable
|
interface Doctrine_Configurable
|
||||||
{
|
{
|
||||||
/**
|
public function getAttribute($name);
|
||||||
* @var array $attributes an array of containing all attributes
|
public function setAttribute($name, $value);
|
||||||
*/
|
public function hasAttribute($name);
|
||||||
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();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array $_params an array of user defined parameters
|
|
||||||
*/
|
|
||||||
//protected $_params = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* setAttribute
|
|
||||||
* sets a given attribute
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* $manager->setAttribute(Doctrine::ATTR_PORTABILITY, Doctrine::PORTABILITY_ALL);
|
|
||||||
*
|
|
||||||
* // or
|
|
||||||
*
|
|
||||||
* $manager->setAttribute('portability', Doctrine::PORTABILITY_ALL);
|
|
||||||
*
|
|
||||||
* // or
|
|
||||||
*
|
|
||||||
* $manager->setAttribute('portability', 'all');
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param mixed $attribute either a Doctrine::ATTR_* integer constant or a string
|
|
||||||
* corresponding to a constant
|
|
||||||
* @param mixed $value the value of the attribute
|
|
||||||
* @see Doctrine::ATTR_* constants
|
|
||||||
* @throws Doctrine_Exception if the value is invalid
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setAttribute($attribute, $value)
|
|
||||||
{
|
|
||||||
if (is_string($attribute)) {
|
|
||||||
$upper = strtoupper($attribute);
|
|
||||||
|
|
||||||
$const = 'Doctrine::ATTR_' . $upper;
|
|
||||||
|
|
||||||
if (defined($const)) {
|
|
||||||
$attribute = constant($const);
|
|
||||||
} else {
|
|
||||||
throw new Doctrine_Exception('Unknown attribute: "' . $attribute . '"');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_string($value) && isset($upper)) {
|
|
||||||
$const = 'Doctrine::' . $upper . '_' . strtoupper($value);
|
|
||||||
|
|
||||||
if (defined($const)) {
|
|
||||||
$value = constant($const);
|
|
||||||
} else {
|
|
||||||
throw new Doctrine_Exception('Unknown attribute value: "' . $value . '"');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($attribute) {
|
|
||||||
case Doctrine::ATTR_FETCHMODE: // deprecated
|
|
||||||
throw new Doctrine_Exception('Deprecated attribute. See http://www.phpdoctrine.org/documentation/manual?chapter=configuration');
|
|
||||||
case Doctrine::ATTR_LISTENER:
|
|
||||||
$this->setEventListener($value);
|
|
||||||
break;
|
|
||||||
case Doctrine::ATTR_COLL_KEY: // class attribute
|
|
||||||
if ( ! ($this instanceof Doctrine_ClassMetadata)) {
|
|
||||||
throw new Doctrine_Exception("This attribute can only be set at class level.");
|
|
||||||
}
|
|
||||||
if ($value !== null && ! $this->hasField($value)) {
|
|
||||||
throw new Doctrine_Exception("Couldn't set collection key attribute. No such field '$value'");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Doctrine::ATTR_CACHE: // deprecated
|
|
||||||
case Doctrine::ATTR_RESULT_CACHE:// manager/session attribute
|
|
||||||
case Doctrine::ATTR_QUERY_CACHE: // manager/session attribute
|
|
||||||
if ($value !== null) {
|
|
||||||
if ( ! ($value instanceof Doctrine_Cache_Interface)) {
|
|
||||||
throw new Doctrine_Exception('Cache driver should implement Doctrine_Cache_Interface');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Doctrine::ATTR_VALIDATE: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_QUERY_LIMIT: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_QUOTE_IDENTIFIER: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_PORTABILITY: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_DEFAULT_TABLE_TYPE: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_EMULATE_DATABASE: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_USE_NATIVE_ENUM: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_DEFAULT_SEQUENCE: // ??
|
|
||||||
case Doctrine::ATTR_EXPORT: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_DECIMAL_PLACES: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_LOAD_REFERENCES: // class attribute
|
|
||||||
case Doctrine::ATTR_RECORD_LISTENER: // not an attribute
|
|
||||||
case Doctrine::ATTR_THROW_EXCEPTIONS: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE:
|
|
||||||
case Doctrine::ATTR_MODEL_LOADING: // manager/session attribute
|
|
||||||
|
|
||||||
break;
|
|
||||||
case Doctrine::ATTR_SEQCOL_NAME: // class attribute
|
|
||||||
if ( ! is_string($value)) {
|
|
||||||
throw new Doctrine_Exception('Sequence column name attribute only accepts string values');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Doctrine::ATTR_FIELD_CASE: // manager/session attribute
|
|
||||||
if ($value != 0 && $value != CASE_LOWER && $value != CASE_UPPER)
|
|
||||||
throw new Doctrine_Exception('Field case attribute should be either 0, CASE_LOWER or CASE_UPPER constant.');
|
|
||||||
break;
|
|
||||||
case Doctrine::ATTR_SEQNAME_FORMAT: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_IDXNAME_FORMAT: // manager/session attribute
|
|
||||||
case Doctrine::ATTR_TBLNAME_FORMAT: // manager/session attribute
|
|
||||||
if ($this instanceof Doctrine_ClassMetadata) {
|
|
||||||
throw new Doctrine_Exception('Sequence / index name format attributes cannot be set'
|
|
||||||
. ' at class level (only at connection or global level).');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Doctrine_Exception("Unknown attribute.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_attributes[$attribute] = $value;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*public function getParams($namespace = null)
|
|
||||||
{
|
|
||||||
if ($namespace == null) {
|
|
||||||
$namespace = $this->getAttribute(Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! isset($this->_params[$namespace])) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->_params[$namespace];
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*public function getParamNamespaces()
|
|
||||||
{
|
|
||||||
return array_keys($this->_params);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*public function setParam($name, $value, $namespace = null)
|
|
||||||
{
|
|
||||||
if ($namespace == null) {
|
|
||||||
$namespace = $this->getAttribute(Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_params[$namespace][$name] = $value;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*public function getParam($name, $value, $namespace)
|
|
||||||
{
|
|
||||||
if ($namespace == null) {
|
|
||||||
$namespace = $this->getAttribute(Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! isset($this->_params[$name])) {
|
|
||||||
if (isset($this->parent)) {
|
|
||||||
return $this->parent->getParam($name);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $this->_params[$name];
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* setImpl
|
|
||||||
* binds given class to given template name
|
|
||||||
*
|
|
||||||
* this method is the base of Doctrine dependency injection
|
|
||||||
*
|
|
||||||
* @param string $template name of the class template
|
|
||||||
* @param string $class name of the class to be bound
|
|
||||||
* @return Doctrine_Configurable this object
|
|
||||||
*/
|
|
||||||
/*public function setImpl($template, $class)
|
|
||||||
{
|
|
||||||
$this->_impl[$template] = $class;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getImpl
|
|
||||||
* returns the implementation for given class
|
|
||||||
*
|
|
||||||
* @return string name of the concrete implementation
|
|
||||||
*/
|
|
||||||
/*public function getImpl($template)
|
|
||||||
{
|
|
||||||
if ( ! isset($this->_impl[$template])) {
|
|
||||||
if (isset($this->parent)) {
|
|
||||||
return $this->parent->getImpl($template);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $this->_impl[$template];
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
/*public function hasImpl($template)
|
|
||||||
{
|
|
||||||
if ( ! isset($this->_impl[$template])) {
|
|
||||||
if (isset($this->parent)) {
|
|
||||||
return $this->parent->hasImpl($template);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Doctrine_EventListener $listener
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setEventListener($listener)
|
|
||||||
{
|
|
||||||
return $this->setListener($listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* addRecordListener
|
|
||||||
*
|
|
||||||
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener
|
|
||||||
* @return mixed this object
|
|
||||||
*/
|
|
||||||
public function addRecordListener($listener, $name = null)
|
|
||||||
{
|
|
||||||
if ( ! isset($this->_attributes[Doctrine::ATTR_RECORD_LISTENER]) ||
|
|
||||||
! ($this->_attributes[Doctrine::ATTR_RECORD_LISTENER] instanceof Doctrine_Record_Listener_Chain)) {
|
|
||||||
|
|
||||||
$this->_attributes[Doctrine::ATTR_RECORD_LISTENER] = new Doctrine_Record_Listener_Chain();
|
|
||||||
}
|
|
||||||
$this->_attributes[Doctrine::ATTR_RECORD_LISTENER]->add($listener, $name);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getListener
|
|
||||||
*
|
|
||||||
* @return Doctrine_EventListener_Interface|Doctrine_Overloadable
|
|
||||||
*/
|
|
||||||
public function getRecordListener()
|
|
||||||
{
|
|
||||||
if ( ! isset($this->_attributes[Doctrine::ATTR_RECORD_LISTENER])) {
|
|
||||||
if (isset($this->parent)) {
|
|
||||||
return $this->parent->getRecordListener();
|
|
||||||
}
|
|
||||||
$this->_attributes[Doctrine::ATTR_RECORD_LISTENER] = new Doctrine_Record_Listener();
|
|
||||||
}
|
|
||||||
return $this->_attributes[Doctrine::ATTR_RECORD_LISTENER];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* setListener
|
|
||||||
*
|
|
||||||
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener
|
|
||||||
* @return Doctrine_Configurable this object
|
|
||||||
*/
|
|
||||||
public function setRecordListener($listener)
|
|
||||||
{
|
|
||||||
if ( ! ($listener instanceof Doctrine_Record_Listener_Interface)
|
|
||||||
&& ! ($listener instanceof Doctrine_Overloadable)
|
|
||||||
) {
|
|
||||||
throw new Doctrine_Exception("Couldn't set eventlistener. Record listeners should implement either Doctrine_Record_Listener_Interface or Doctrine_Overloadable");
|
|
||||||
}
|
|
||||||
$this->_attributes[Doctrine::ATTR_RECORD_LISTENER] = $listener;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeRecordListeners()
|
|
||||||
{
|
|
||||||
$this->_attributes[Doctrine::ATTR_RECORD_LISTENER] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* addListener
|
|
||||||
*
|
|
||||||
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener
|
|
||||||
* @return mixed this object
|
|
||||||
*/
|
|
||||||
public function addListener($listener, $name = null)
|
|
||||||
{
|
|
||||||
if ( ! isset($this->_attributes[Doctrine::ATTR_LISTENER]) ||
|
|
||||||
! ($this->_attributes[Doctrine::ATTR_LISTENER] instanceof Doctrine_EventListener_Chain)) {
|
|
||||||
|
|
||||||
$this->_attributes[Doctrine::ATTR_LISTENER] = new Doctrine_EventListener_Chain();
|
|
||||||
}
|
|
||||||
$this->_attributes[Doctrine::ATTR_LISTENER]->add($listener, $name);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getListener
|
|
||||||
*
|
|
||||||
* @return Doctrine_EventListener_Interface|Doctrine_Overloadable
|
|
||||||
*/
|
|
||||||
public function getListener()
|
|
||||||
{
|
|
||||||
if ( ! isset($this->_attributes[Doctrine::ATTR_LISTENER])) {
|
|
||||||
if (isset($this->parent)) {
|
|
||||||
return $this->parent->getListener();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $this->_attributes[Doctrine::ATTR_LISTENER];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* setListener
|
|
||||||
*
|
|
||||||
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener
|
|
||||||
* @return Doctrine_Configurable this object
|
|
||||||
*/
|
|
||||||
public function setListener($listener)
|
|
||||||
{
|
|
||||||
if ( ! ($listener instanceof Doctrine_EventListener_Interface)
|
|
||||||
&& ! ($listener instanceof Doctrine_Overloadable)) {
|
|
||||||
throw new Doctrine_EventListener_Exception("Couldn't set eventlistener. EventListeners should implement either Doctrine_EventListener_Interface or Doctrine_Overloadable");
|
|
||||||
}
|
|
||||||
$this->_attributes[Doctrine::ATTR_LISTENER] = $listener;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the value of an attribute
|
|
||||||
*
|
|
||||||
* @param integer $attribute
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getAttribute($attribute)
|
|
||||||
{
|
|
||||||
if (is_string($attribute)) {
|
|
||||||
$upper = strtoupper($attribute);
|
|
||||||
|
|
||||||
$const = 'Doctrine::ATTR_' . $upper;
|
|
||||||
|
|
||||||
if (defined($const)) {
|
|
||||||
$attribute = constant($const);
|
|
||||||
} else {
|
|
||||||
throw new Doctrine_Exception('Unknown attribute: "' . $attribute . '"');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$attribute = (int) $attribute;
|
|
||||||
|
|
||||||
if ($attribute < 0) {
|
|
||||||
throw new Doctrine_Exception('Unknown attribute.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($this->_attributes[$attribute])) {
|
|
||||||
return $this->_attributes[$attribute];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($this->parent)) {
|
|
||||||
return $this->parent->getAttribute($attribute);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getAttributes
|
|
||||||
* returns all attributes as an array
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getAttributes()
|
|
||||||
{
|
|
||||||
return $this->_attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a parent for this configurable component
|
|
||||||
* the parent must be a configurable component itself.
|
|
||||||
*
|
|
||||||
* @param Doctrine_Configurable $component
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setConfigurableParent(Doctrine_Configurable $component)
|
|
||||||
{
|
|
||||||
$this->parent = $component;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getParent
|
|
||||||
* Returns the parent of this component.
|
|
||||||
*
|
|
||||||
* @return Doctrine_Configurable
|
|
||||||
*/
|
|
||||||
public function getParent()
|
|
||||||
{
|
|
||||||
return $this->parent;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::DBAL::Connections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Connection
|
* Doctrine_Connection
|
||||||
*
|
*
|
||||||
@ -58,7 +60,7 @@
|
|||||||
* it sits one layer below.
|
* it sits one layer below.
|
||||||
* Right now, this is the unification of these two classes.
|
* Right now, this is the unification of these two classes.
|
||||||
*/
|
*/
|
||||||
abstract class Doctrine_Connection extends Doctrine_Configurable implements Countable
|
abstract class Doctrine_Connection implements Doctrine_Configurable, Countable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The PDO database handle.
|
* The PDO database handle.
|
||||||
@ -67,6 +69,13 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
|||||||
*/
|
*/
|
||||||
protected $dbh;
|
protected $dbh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_attributes = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $_name
|
* $_name
|
||||||
*
|
*
|
||||||
@ -143,13 +152,6 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
|||||||
/*
|
/*
|
||||||
* ----------- Mixed attributes (need to split up) ---------------
|
* ----------- Mixed attributes (need to split up) ---------------
|
||||||
*/
|
*/
|
||||||
/**
|
|
||||||
* @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
|
* @var array $modules an array containing all modules
|
||||||
* transaction Doctrine_Transaction driver, handles savepoint and transaction isolation abstraction
|
* transaction Doctrine_Transaction driver, handles savepoint and transaction isolation abstraction
|
||||||
@ -184,14 +186,13 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
|||||||
'export' => false,
|
'export' => false,
|
||||||
'import' => false,
|
'import' => false,
|
||||||
'sequence' => false,
|
'sequence' => false,
|
||||||
'unitOfWork' => false,
|
|
||||||
'formatter' => false,
|
'formatter' => false,
|
||||||
'util' => false,
|
'util' => false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the constructor
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param Doctrine_Manager $manager the manager object
|
* @param Doctrine_Manager $manager the manager object
|
||||||
* @param PDO|Doctrine_Adapter_Interface $adapter database driver
|
* @param PDO|Doctrine_Adapter_Interface $adapter database driver
|
||||||
@ -220,34 +221,6 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* getOption
|
|
||||||
*
|
|
||||||
* Retrieves option
|
|
||||||
*
|
|
||||||
* @param string $option
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function getOption($option)
|
|
||||||
{
|
|
||||||
if (isset($this->options[$option])) {
|
|
||||||
return $this->options[$option];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* setOption
|
|
||||||
*
|
|
||||||
* Set option value
|
|
||||||
*
|
|
||||||
* @param string $option
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setOption($option, $value)
|
|
||||||
{
|
|
||||||
return $this->options[$option] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns an array of available PDO drivers
|
* returns an array of available PDO drivers
|
||||||
*/
|
*/
|
||||||
@ -301,7 +274,6 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
|||||||
{
|
{
|
||||||
//$this->connect();
|
//$this->connect();
|
||||||
|
|
||||||
|
|
||||||
return $this->dbh;
|
return $this->dbh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,9 +1093,14 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
|||||||
*/
|
*/
|
||||||
public function getAttribute($attribute)
|
public function getAttribute($attribute)
|
||||||
{
|
{
|
||||||
|
if ($attribute == Doctrine::ATTR_QUOTE_IDENTIFIER) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* legacy */
|
||||||
if ($attribute >= 100) {
|
if ($attribute >= 100) {
|
||||||
if ( ! isset($this->_attributes[$attribute])) {
|
if ( ! isset($this->_attributes[$attribute])) {
|
||||||
return parent::getAttribute($attribute);
|
return null;
|
||||||
}
|
}
|
||||||
return $this->_attributes[$attribute];
|
return $this->_attributes[$attribute];
|
||||||
}
|
}
|
||||||
@ -1169,6 +1146,11 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasAttribute($name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __get
|
* __get
|
||||||
* lazy loads given module and returns it
|
* lazy loads given module and returns it
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM::Internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The UnitOfWork is responsible for writing out changes to the database at
|
* The UnitOfWork is responsible for writing out changes to the database at
|
||||||
* the correct time and in the correct order.
|
* the correct time and in the correct order.
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::DBAL::DataDicts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_DataDict
|
* Doctrine_DataDict
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Entity
|
* Doctrine_Entity
|
||||||
* All record classes should inherit this super class
|
* All record classes should inherit this super class
|
||||||
@ -997,7 +999,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Countable, Ite
|
|||||||
if ($getter = $this->_getCustomAccessor($fieldName)) {
|
if ($getter = $this->_getCustomAccessor($fieldName)) {
|
||||||
return $this->$getter();
|
return $this->$getter();
|
||||||
}
|
}
|
||||||
$this->_invokeCustomAccessor($fieldName);
|
|
||||||
|
|
||||||
// Use built-in accessor functionality
|
// Use built-in accessor functionality
|
||||||
$nullObj = Doctrine_Null::$INSTANCE;
|
$nullObj = Doctrine_Null::$INSTANCE;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#namespace Doctrine::ORM;
|
#namespace org::phpdoctrine::orm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The EntityManager is a central access point to ORM functionality.
|
* The EntityManager is a central access point to ORM functionality.
|
||||||
@ -113,6 +113,13 @@ class Doctrine_EntityManager
|
|||||||
*/
|
*/
|
||||||
private $_unitOfWork;
|
private $_unitOfWork;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The event manager that is the central point of the event system.
|
||||||
|
*
|
||||||
|
* @var EventManager
|
||||||
|
*/
|
||||||
|
private $_eventManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Enter description here...
|
||||||
*
|
*
|
||||||
@ -130,9 +137,11 @@ class Doctrine_EntityManager
|
|||||||
{
|
{
|
||||||
$this->_conn = $conn;
|
$this->_conn = $conn;
|
||||||
$this->_name = $name;
|
$this->_name = $name;
|
||||||
$this->_metadataFactory = new Doctrine_ClassMetadata_Factory($this,
|
$this->_metadataFactory = new Doctrine_ClassMetadata_Factory(
|
||||||
new Doctrine_ClassMetadata_CodeDriver());
|
$this, new Doctrine_ClassMetadata_CodeDriver());
|
||||||
$this->_unitOfWork = new Doctrine_Connection_UnitOfWork($conn);
|
$this->_unitOfWork = new Doctrine_Connection_UnitOfWork($conn);
|
||||||
|
$this->_eventManager = new Doctrine_EventManager();
|
||||||
|
|
||||||
if ($name !== null) {
|
if ($name !== null) {
|
||||||
self::$_ems[$name] = $this;
|
self::$_ems[$name] = $this;
|
||||||
} else {
|
} else {
|
||||||
@ -164,10 +173,10 @@ class Doctrine_EntityManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Binds an Entity to a specific EntityManager.
|
||||||
*
|
*
|
||||||
* @param unknown_type $entityName
|
* @param string $entityName
|
||||||
* @param unknown_type $emName
|
* @param string $emName
|
||||||
*/
|
*/
|
||||||
public static function bindEntityToManager($entityName, $emName)
|
public static function bindEntityToManager($entityName, $emName)
|
||||||
{
|
{
|
||||||
@ -544,10 +553,25 @@ class Doctrine_EntityManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the UnitOfWork used by the EntityManager.
|
||||||
|
*
|
||||||
|
* @return UnitOfWork
|
||||||
|
*/
|
||||||
public function getUnitOfWork()
|
public function getUnitOfWork()
|
||||||
{
|
{
|
||||||
return $this->_unitOfWork;
|
return $this->_unitOfWork;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the EventManager used by the EntityManager.
|
||||||
|
*
|
||||||
|
* @return EventManager
|
||||||
|
*/
|
||||||
|
public function getEventManager()
|
||||||
|
{
|
||||||
|
return $this->_eventManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all custom user-defined repositories.
|
* Base class for all custom user-defined repositories.
|
||||||
* Provides basic finder methods, common to all repositories.
|
* Provides basic finder methods, common to all repositories.
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM::Events;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Event
|
* Doctrine_Event
|
||||||
*
|
*
|
||||||
@ -32,9 +34,13 @@
|
|||||||
*/
|
*/
|
||||||
class Doctrine_Event
|
class Doctrine_Event
|
||||||
{
|
{
|
||||||
/**
|
/* Event callback constants */
|
||||||
* CONNECTION EVENT CODES
|
const preDelete = 'preDelete';
|
||||||
*/
|
const postDelete = 'postDelete';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
const CONN_QUERY = 1;
|
const CONN_QUERY = 1;
|
||||||
const CONN_EXEC = 2;
|
const CONN_EXEC = 2;
|
||||||
const CONN_PREPARE = 3;
|
const CONN_PREPARE = 3;
|
||||||
@ -55,51 +61,48 @@ class Doctrine_Event
|
|||||||
|
|
||||||
const HYDRATE = 40;
|
const HYDRATE = 40;
|
||||||
|
|
||||||
/*
|
|
||||||
* RECORD EVENT CODES
|
|
||||||
*/
|
|
||||||
const RECORD_DELETE = 21;
|
const RECORD_DELETE = 21;
|
||||||
const RECORD_SAVE = 22;
|
const RECORD_SAVE = 22;
|
||||||
const RECORD_UPDATE = 23;
|
const RECORD_UPDATE = 23;
|
||||||
const RECORD_INSERT = 24;
|
const RECORD_INSERT = 24;
|
||||||
const RECORD_SERIALIZE = 25;
|
const RECORD_SERIALIZE = 25;
|
||||||
const RECORD_UNSERIALIZE = 26;
|
const RECORD_UNSERIALIZE = 26;
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @var mixed $_invoker the handler which invoked this event
|
* @var mixed $_invoker the handler which invoked this event
|
||||||
*/
|
*/
|
||||||
protected $_invoker;
|
//protected $_invoker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $_query the sql query associated with this event (if any)
|
* @var string $_query the sql query associated with this event (if any)
|
||||||
*/
|
*/
|
||||||
protected $_query;
|
//protected $_query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $_params the parameters associated with the query (if any)
|
* @var string $_params the parameters associated with the query (if any)
|
||||||
*/
|
*/
|
||||||
protected $_params;
|
//protected $_params;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Doctrine_Event constants
|
* @see Doctrine_Event constants
|
||||||
* @var integer $_code the event code
|
* @var integer $_code the event code
|
||||||
*/
|
*/
|
||||||
protected $_code;
|
//protected $_code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer $_startedMicrotime the time point in which this event was started
|
* @var integer $_startedMicrotime the time point in which this event was started
|
||||||
*/
|
*/
|
||||||
protected $_startedMicrotime;
|
//protected $_startedMicrotime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer $_endedMicrotime the time point in which this event was ended
|
* @var integer $_endedMicrotime the time point in which this event was ended
|
||||||
*/
|
*/
|
||||||
protected $_endedMicrotime;
|
//protected $_endedMicrotime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array $_options an array of options
|
* @var array $_options an array of options
|
||||||
*/
|
*/
|
||||||
protected $_options = array();
|
//protected $_options = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
@ -109,23 +112,23 @@ class Doctrine_Event
|
|||||||
* @param integer $code the event code
|
* @param integer $code the event code
|
||||||
* @param string $query the sql query associated with this event (if any)
|
* @param string $query the sql query associated with this event (if any)
|
||||||
*/
|
*/
|
||||||
public function __construct($invoker, $code, $query = null, $params = array())
|
/*public function __construct($invoker, $code, $query = null, $params = array())
|
||||||
{
|
{
|
||||||
$this->_invoker = $invoker;
|
$this->_invoker = $invoker;
|
||||||
$this->_code = $code;
|
$this->_code = $code;
|
||||||
$this->_query = $query;
|
$this->_query = $query;
|
||||||
$this->_params = $params;
|
$this->_params = $params;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getQuery
|
* getQuery
|
||||||
*
|
*
|
||||||
* @return string returns the query associated with this event (if any)
|
* @return string returns the query associated with this event (if any)
|
||||||
*/
|
*/
|
||||||
public function getQuery()
|
/*public function getQuery()
|
||||||
{
|
{
|
||||||
return $this->_query;
|
return $this->_query;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getName
|
* getName
|
||||||
@ -133,7 +136,7 @@ class Doctrine_Event
|
|||||||
*
|
*
|
||||||
* @return string the name of this event
|
* @return string the name of this event
|
||||||
*/
|
*/
|
||||||
public function getName()
|
/*public function getName()
|
||||||
{
|
{
|
||||||
switch ($this->_code) {
|
switch ($this->_code) {
|
||||||
case self::CONN_QUERY:
|
case self::CONN_QUERY:
|
||||||
@ -184,16 +187,16 @@ class Doctrine_Event
|
|||||||
return 'unserialize record';
|
return 'unserialize record';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* getCode
|
* getCode
|
||||||
*
|
*
|
||||||
* @return integer returns the code associated with this event
|
* @return integer returns the code associated with this event
|
||||||
*/
|
*/
|
||||||
public function getCode()
|
/*public function getCode()
|
||||||
{
|
{
|
||||||
return $this->_code;
|
return $this->_code;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getOption
|
* getOption
|
||||||
@ -202,14 +205,14 @@ class Doctrine_Event
|
|||||||
* @param string $option the name of the option
|
* @param string $option the name of the option
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __get($option)
|
/*public function __get($option)
|
||||||
{
|
{
|
||||||
if ( ! isset($this->_options[$option])) {
|
if ( ! isset($this->_options[$option])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_options[$option];
|
return $this->_options[$option];
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* skipOperation
|
* skipOperation
|
||||||
@ -218,12 +221,12 @@ class Doctrine_Event
|
|||||||
*
|
*
|
||||||
* @return Doctrine_Event this object
|
* @return Doctrine_Event this object
|
||||||
*/
|
*/
|
||||||
public function skipOperation()
|
/*public function skipOperation()
|
||||||
{
|
{
|
||||||
$this->_options['skipOperation'] = true;
|
$this->_options['skipOperation'] = true;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setOption
|
* setOption
|
||||||
@ -233,12 +236,12 @@ class Doctrine_Event
|
|||||||
* @param mixed $value the value of the given option
|
* @param mixed $value the value of the given option
|
||||||
* @return Doctrine_Event this object
|
* @return Doctrine_Event this object
|
||||||
*/
|
*/
|
||||||
public function __set($option, $value)
|
/*public function __set($option, $value)
|
||||||
{
|
{
|
||||||
$this->_options[$option] = $value;
|
$this->_options[$option] = $value;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setOption
|
* setOption
|
||||||
@ -248,12 +251,12 @@ class Doctrine_Event
|
|||||||
* @param mixed $value the value of the given option
|
* @param mixed $value the value of the given option
|
||||||
* @return Doctrine_Event this object
|
* @return Doctrine_Event this object
|
||||||
*/
|
*/
|
||||||
public function set($option, &$value)
|
/*public function set($option, &$value)
|
||||||
{
|
{
|
||||||
$this->_options[$option] =& $value;
|
$this->_options[$option] =& $value;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* start
|
* start
|
||||||
@ -261,10 +264,10 @@ class Doctrine_Event
|
|||||||
*
|
*
|
||||||
* @return Doctrine_Event this object
|
* @return Doctrine_Event this object
|
||||||
*/
|
*/
|
||||||
public function start()
|
/*public function start()
|
||||||
{
|
{
|
||||||
$this->_startedMicrotime = microtime(true);
|
$this->_startedMicrotime = microtime(true);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hasEnded
|
* hasEnded
|
||||||
@ -272,10 +275,10 @@ class Doctrine_Event
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasEnded()
|
/*public function hasEnded()
|
||||||
{
|
{
|
||||||
return ($this->_endedMicrotime != null);
|
return ($this->_endedMicrotime != null);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* end
|
* end
|
||||||
@ -283,12 +286,12 @@ class Doctrine_Event
|
|||||||
*
|
*
|
||||||
* @return Doctrine_Event this object
|
* @return Doctrine_Event this object
|
||||||
*/
|
*/
|
||||||
public function end()
|
/*public function end()
|
||||||
{
|
{
|
||||||
$this->_endedMicrotime = microtime(true);
|
$this->_endedMicrotime = microtime(true);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getInvoker
|
* getInvoker
|
||||||
@ -297,10 +300,10 @@ class Doctrine_Event
|
|||||||
* @return Doctrine_Connection|Doctrine_Connection_Statement|
|
* @return Doctrine_Connection|Doctrine_Connection_Statement|
|
||||||
* Doctrine_Connection_UnitOfWork|Doctrine_Transaction the handler that invoked this event
|
* Doctrine_Connection_UnitOfWork|Doctrine_Transaction the handler that invoked this event
|
||||||
*/
|
*/
|
||||||
public function getInvoker()
|
/*public function getInvoker()
|
||||||
{
|
{
|
||||||
return $this->_invoker;
|
return $this->_invoker;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getParams
|
* getParams
|
||||||
@ -308,10 +311,10 @@ class Doctrine_Event
|
|||||||
*
|
*
|
||||||
* @return array parameters of the query
|
* @return array parameters of the query
|
||||||
*/
|
*/
|
||||||
public function getParams()
|
/*public function getParams()
|
||||||
{
|
{
|
||||||
return $this->_params;
|
return $this->_params;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the elapsed time (in microseconds) that the event ran. If the event has
|
* Get the elapsed time (in microseconds) that the event ran. If the event has
|
||||||
@ -319,11 +322,11 @@ class Doctrine_Event
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getElapsedSecs()
|
/*public function getElapsedSecs()
|
||||||
{
|
{
|
||||||
if (is_null($this->_endedMicrotime)) {
|
if (is_null($this->_endedMicrotime)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return ($this->_endedMicrotime - $this->_startedMicrotime);
|
return ($this->_endedMicrotime - $this->_startedMicrotime);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM::Exceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Exception
|
* Doctrine_Exception
|
||||||
*
|
*
|
||||||
@ -29,64 +31,21 @@
|
|||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||||
|
* @author Roman Borschel <roman@code-factory.org>
|
||||||
*/
|
*/
|
||||||
class Doctrine_Exception extends Exception
|
class Doctrine_Exception extends Exception
|
||||||
{
|
{
|
||||||
/**
|
private $_innerException;
|
||||||
* @var array $_errorMessages an array of error messages
|
|
||||||
*/
|
|
||||||
protected static $_errorMessages = array(
|
|
||||||
Doctrine::ERR => 'unknown error',
|
|
||||||
Doctrine::ERR_ALREADY_EXISTS => 'already exists',
|
|
||||||
Doctrine::ERR_CANNOT_CREATE => 'can not create',
|
|
||||||
Doctrine::ERR_CANNOT_ALTER => 'can not alter',
|
|
||||||
Doctrine::ERR_CANNOT_REPLACE => 'can not replace',
|
|
||||||
Doctrine::ERR_CANNOT_DELETE => 'can not delete',
|
|
||||||
Doctrine::ERR_CANNOT_DROP => 'can not drop',
|
|
||||||
Doctrine::ERR_CONSTRAINT => 'constraint violation',
|
|
||||||
Doctrine::ERR_CONSTRAINT_NOT_NULL=> 'null value violates not-null constraint',
|
|
||||||
Doctrine::ERR_DIVZERO => 'division by zero',
|
|
||||||
Doctrine::ERR_INVALID => 'invalid',
|
|
||||||
Doctrine::ERR_INVALID_DATE => 'invalid date or time',
|
|
||||||
Doctrine::ERR_INVALID_NUMBER => 'invalid number',
|
|
||||||
Doctrine::ERR_MISMATCH => 'mismatch',
|
|
||||||
Doctrine::ERR_NODBSELECTED => 'no database selected',
|
|
||||||
Doctrine::ERR_NOSUCHFIELD => 'no such field',
|
|
||||||
Doctrine::ERR_NOSUCHTABLE => 'no such table',
|
|
||||||
Doctrine::ERR_NOT_CAPABLE => 'Doctrine backend not capable',
|
|
||||||
Doctrine::ERR_NOT_FOUND => 'not found',
|
|
||||||
Doctrine::ERR_NOT_LOCKED => 'not locked',
|
|
||||||
Doctrine::ERR_SYNTAX => 'syntax error',
|
|
||||||
Doctrine::ERR_UNSUPPORTED => 'not supported',
|
|
||||||
Doctrine::ERR_VALUE_COUNT_ON_ROW => 'value count on row',
|
|
||||||
Doctrine::ERR_INVALID_DSN => 'invalid DSN',
|
|
||||||
Doctrine::ERR_CONNECT_FAILED => 'connect failed',
|
|
||||||
Doctrine::ERR_NEED_MORE_DATA => 'insufficient data supplied',
|
|
||||||
Doctrine::ERR_EXTENSION_NOT_FOUND=> 'extension not found',
|
|
||||||
Doctrine::ERR_NOSUCHDB => 'no such database',
|
|
||||||
Doctrine::ERR_ACCESS_VIOLATION => 'insufficient permissions',
|
|
||||||
Doctrine::ERR_LOADMODULE => 'error while including on demand module',
|
|
||||||
Doctrine::ERR_TRUNCATED => 'truncated',
|
|
||||||
Doctrine::ERR_DEADLOCK => 'deadlock detected',
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
public function __construct($message = "", Doctrine_Exception $innerException = null)
|
||||||
* Return a textual error message for a Doctrine error code
|
|
||||||
*
|
|
||||||
* @param int|array integer error code,
|
|
||||||
* null to get the current error code-message map,
|
|
||||||
* or an array with a new error code-message map
|
|
||||||
*
|
|
||||||
* @return string error message
|
|
||||||
*/
|
|
||||||
public function errorMessage($value = null)
|
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
parent::__construct($message);
|
||||||
return self::$_errorMessages;
|
$this->_innerException = $innerException;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isset(self::$_errorMessages[$value]) ?
|
public function getInnerException()
|
||||||
self::$_errorMessages[$value] : self::$_errorMessages[Doctrine::ERR];
|
{
|
||||||
|
return $this->_innerException;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
* and is licensed under the LGPL. For more information, see
|
* and is licensed under the LGPL. For more information, see
|
||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
Doctrine::autoload('Doctrine_Connection_Module');
|
|
||||||
|
#namespace Doctrine::DBAL::Export;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Export
|
* Doctrine_Export
|
||||||
*
|
*
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
* and is licensed under the LGPL. For more information, see
|
* and is licensed under the LGPL. For more information, see
|
||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
Doctrine::autoload('Doctrine_Connection_Module');
|
|
||||||
|
#namespace Doctrine::DBAL::Expressions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Expression
|
* Doctrine_Expression
|
||||||
*
|
*
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
* and is licensed under the LGPL. For more information, see
|
* and is licensed under the LGPL. For more information, see
|
||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
Doctrine::autoload('Doctrine_Connection_Module');
|
|
||||||
|
#namespace Doctrine::DBAL::Tools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Formatter
|
* Doctrine_Formatter
|
||||||
*
|
*
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||||
|
* @todo May be no longer useful and can be removed later.
|
||||||
*/
|
*/
|
||||||
class Doctrine_Hook
|
class Doctrine_Hook
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM::Internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The hydrator has the tedious to process result sets returned by the database
|
* The hydrator has the tedious to process result sets returned by the database
|
||||||
* and turn them into useable structures.
|
* and turn them into useable structures.
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::Behaviors::I18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_I18n
|
* Doctrine_I18n
|
||||||
*
|
*
|
||||||
@ -29,6 +31,7 @@
|
|||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||||
|
* @todo To "Doctrine Behaviors" package. Separate download.
|
||||||
*/
|
*/
|
||||||
class Doctrine_I18n extends Doctrine_Record_Generator
|
class Doctrine_I18n extends Doctrine_Record_Generator
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
* and is licensed under the LGPL. For more information, see
|
* and is licensed under the LGPL. For more information, see
|
||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
Doctrine::autoload('Doctrine_Connection_Module');
|
|
||||||
|
#namespace Doctrine::DBAL::Import;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class Doctrine_Import
|
* class Doctrine_Import
|
||||||
* Main responsible of performing import operation. Delegates database schema
|
* Main responsible of performing import operation. Delegates database schema
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM::Tools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Inflector has static methods for inflecting text
|
* Doctrine_Inflector has static methods for inflecting text
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM::Tools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Lib has not commonly used static functions, mostly for debugging purposes
|
* Doctrine_Lib has not commonly used static functions, mostly for debugging purposes
|
||||||
*
|
*
|
||||||
@ -29,6 +31,7 @@
|
|||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||||
|
* @todo Split into DBAL/ORM parts. DBAL class goes into Doctrine::DBAL::Tools
|
||||||
*/
|
*/
|
||||||
class Doctrine_Lib
|
class Doctrine_Lib
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* @link www.phpdoctrine.org
|
* @link www.phpdoctrine.org
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Revision: 3155 $
|
* @version $Revision: 3155 $
|
||||||
|
* @todo Can possibly be removed.
|
||||||
*/
|
*/
|
||||||
class Doctrine_Log
|
class Doctrine_Log
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||||
*/
|
*/
|
||||||
class Doctrine_Manager extends Doctrine_Configurable implements Countable, IteratorAggregate
|
class Doctrine_Manager implements Doctrine_Configurable, Countable, IteratorAggregate
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var array $connections an array containing all the opened connections
|
* @var array $connections an array containing all the opened connections
|
||||||
@ -124,46 +124,13 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
|
|||||||
|
|
||||||
public function hasAttribute($key)
|
public function hasAttribute($key)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
return false;
|
||||||
case Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE:
|
}
|
||||||
case Doctrine::ATTR_COLL_KEY:
|
|
||||||
case Doctrine::ATTR_SEQCOL_NAME:
|
public function setAttribute($name, $value) {}
|
||||||
case Doctrine::ATTR_LISTENER:
|
public function getAttribute($name) {
|
||||||
case Doctrine::ATTR_RECORD_LISTENER:
|
if ($name == Doctrine::ATTR_MODEL_LOADING) {
|
||||||
case Doctrine::ATTR_QUOTE_IDENTIFIER:
|
return Doctrine::MODEL_LOADING_CONSERVATIVE;
|
||||||
case Doctrine::ATTR_FIELD_CASE:
|
|
||||||
case Doctrine::ATTR_IDXNAME_FORMAT:
|
|
||||||
case Doctrine::ATTR_SEQNAME_FORMAT:
|
|
||||||
case Doctrine::ATTR_DBNAME_FORMAT:
|
|
||||||
case Doctrine::ATTR_TBLCLASS_FORMAT:
|
|
||||||
case Doctrine::ATTR_TBLNAME_FORMAT:
|
|
||||||
case Doctrine::ATTR_EXPORT:
|
|
||||||
case Doctrine::ATTR_DECIMAL_PLACES:
|
|
||||||
case Doctrine::ATTR_PORTABILITY:
|
|
||||||
case Doctrine::ATTR_VALIDATE:
|
|
||||||
case Doctrine::ATTR_QUERY_LIMIT:
|
|
||||||
case Doctrine::ATTR_DEFAULT_TABLE_TYPE:
|
|
||||||
case Doctrine::ATTR_DEF_TEXT_LENGTH:
|
|
||||||
case Doctrine::ATTR_DEF_VARCHAR_LENGTH:
|
|
||||||
case Doctrine::ATTR_DEF_TABLESPACE:
|
|
||||||
case Doctrine::ATTR_EMULATE_DATABASE:
|
|
||||||
case Doctrine::ATTR_USE_NATIVE_ENUM:
|
|
||||||
case Doctrine::ATTR_CREATE_TABLES:
|
|
||||||
case Doctrine::ATTR_COLL_LIMIT:
|
|
||||||
case Doctrine::ATTR_CACHE: // deprecated
|
|
||||||
case Doctrine::ATTR_RESULT_CACHE:
|
|
||||||
case Doctrine::ATTR_CACHE_LIFESPAN: // deprecated
|
|
||||||
case Doctrine::ATTR_RESULT_CACHE_LIFESPAN:
|
|
||||||
case Doctrine::ATTR_LOAD_REFERENCES:
|
|
||||||
case Doctrine::ATTR_THROW_EXCEPTIONS:
|
|
||||||
case Doctrine::ATTR_QUERY_CACHE:
|
|
||||||
case Doctrine::ATTR_QUERY_CACHE_LIFESPAN:
|
|
||||||
case Doctrine::ATTR_MODEL_LOADING:
|
|
||||||
case Doctrine::ATTR_METADATA_CACHE:
|
|
||||||
case Doctrine::ATTR_METADATA_CACHE_LIFESPAN:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::Migration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Migration
|
* Doctrine_Migration
|
||||||
*
|
*
|
||||||
@ -29,6 +31,7 @@
|
|||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Revision: 1080 $
|
* @version $Revision: 1080 $
|
||||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||||
|
* @todo Move to "Doctrine Migration" package. Separate download.
|
||||||
*/
|
*/
|
||||||
class Doctrine_Migration
|
class Doctrine_Migration
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM::Internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Null class representing a null value that has been fetched from
|
* Null class representing a null value that has been fetched from
|
||||||
* the database or a fetched, empty association. This is for internal use only.
|
* the database or a fetched, empty association. This is for internal use only.
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* and is licensed under the LGPL. For more information, see
|
* and is licensed under the LGPL. For more information, see
|
||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
Doctrine::autoload('Doctrine_Relation');
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Relation_ForeignKey
|
* Doctrine_Relation_ForeignKey
|
||||||
* This class represents a foreign key relation
|
* This class represents a foreign key relation
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::Search;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Search
|
* Doctrine_Search
|
||||||
*
|
*
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
* and is licensed under the LGPL. For more information, see
|
* and is licensed under the LGPL. For more information, see
|
||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
Doctrine::autoload('Doctrine_Connection_Module');
|
|
||||||
|
#namespace Doctrine::DBAL::Transactions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Transaction
|
* Doctrine_Transaction
|
||||||
* Handles transaction savepoint and isolation abstraction
|
* Handles transaction savepoint and isolation abstraction
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* and is licensed under the LGPL. For more information, see
|
* and is licensed under the LGPL. For more information, see
|
||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
Doctrine::autoload('Doctrine_Connection_Module');
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Util
|
* Doctrine_Util
|
||||||
*
|
*
|
||||||
@ -29,6 +29,7 @@ Doctrine::autoload('Doctrine_Connection_Module');
|
|||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||||
|
* @todo Remove?
|
||||||
*/
|
*/
|
||||||
class Doctrine_Util extends Doctrine_Connection_Module
|
class Doctrine_Util extends Doctrine_Connection_Module
|
||||||
{ }
|
{ }
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::Validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_Validator
|
* Doctrine_Validator
|
||||||
* Doctrine_Validator performs validations on record properties
|
* Doctrine_Validator performs validations on record properties
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* <http://www.phpdoctrine.org>.
|
* <http://www.phpdoctrine.org>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#namespace Doctrine::ORM::?;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doctrine_View
|
* Doctrine_View
|
||||||
*
|
*
|
||||||
@ -31,6 +33,7 @@
|
|||||||
* @link www.phpdoctrine.org
|
* @link www.phpdoctrine.org
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
|
* @todo Maybe needs a reworked implementation and a new place.
|
||||||
*/
|
*/
|
||||||
class Doctrine_View
|
class Doctrine_View
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#namespace Doctrine::Tests::ORM::Hydration;
|
||||||
|
|
||||||
require_once 'lib/DoctrineTestInit.php';
|
require_once 'lib/DoctrineTestInit.php';
|
||||||
require_once 'lib/mocks/Doctrine_HydratorMockStatement.php';
|
require_once 'lib/mocks/Doctrine_HydratorMockStatement.php';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user