1
0
mirror of synced 2025-01-20 07:21:40 +03:00
This commit is contained in:
romanb 2008-07-27 19:38:56 +00:00
parent d17a68a407
commit a769997450
38 changed files with 554 additions and 877 deletions

View File

@ -34,6 +34,8 @@
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Consider making Collection & Entity implement ArrayAccess directly.
* This base class is not really a huge benefit.
*/
abstract class Doctrine_Access implements ArrayAccess
{

View File

@ -33,16 +33,16 @@ class Doctrine_Association_ManyToMany extends Doctrine_Association
private $_relationTableName;
/** The field in the source table that corresponds to the key in the relation table */
protected $_sourceKeyFields;
protected $_sourceKeyColumns;
/** The field in the target table that corresponds to the key in the relation table */
protected $_targetKeyFields;
protected $_targetKeyColumns;
/** The field in the intermediate table that corresponds to the key in the source table */
protected $_sourceRelationKeyFields;
protected $_sourceRelationKeyColumns;
/** The field in the intermediate table that corresponds to the key in the target table */
protected $_targetRelationKeyFields;
protected $_targetRelationKeyColumns;
/**

View File

@ -4,24 +4,24 @@
class Doctrine_Association_OneToMany extends Doctrine_Association
{
/** The target foreign key fields that reference the sourceKeyFields. */
protected $_targetForeignKeyFields;
/** The target foreign key columns that reference the sourceKeyColumns. */
protected $_targetForeignKeyColumns;
/** The (typically primary) source key fields that are referenced by the targetForeignKeyFields. */
protected $_sourceKeyFields;
/** The (typically primary) source key columns that are referenced by the targetForeignKeyColumns. */
protected $_sourceKeyColumns;
/** This maps the target foreign key fields to the corresponding (primary) source key fields. */
/** This maps the target foreign key columns to the corresponding (primary) source key columns. */
protected $_targetForeignKeysToSourceKeys;
/** This maps the (primary) source key fields to the corresponding target foreign key fields. */
/** This maps the (primary) source key columns to the corresponding target foreign key columns. */
protected $_sourceKeysToTargetForeignKeys;
/** Whether to delete orphaned elements (removed from the collection) */
protected $_isCascadeDeleteOrphan = false;
protected $_deleteOrphans = false;
public function isCascadeDeleteOrphan()
public function shouldDeleteOrphans()
{
return $this->_isCascadeDeleteOrphan;
return $this->_deleteOrphans;
}
}

View File

@ -34,19 +34,22 @@
class Doctrine_Association_OneToOne extends Doctrine_Association
{
/**
* Maps the source foreign/primary key fields to the target primary/foreign key fields.
* Maps the source foreign/primary key columns to the target primary/foreign key columns.
* i.e. source.id (pk) => target.user_id (fk).
* Reverse mapping of _targetToSourceKeyFields.
* Reverse mapping of _targetToSourceKeyColumns.
*/
protected $_sourceToTargetKeyColumns = array();
/**
* Maps the target primary/foreign key fields to the source foreign/primary key fields.
* Maps the target primary/foreign key columns to the source foreign/primary key columns.
* i.e. target.user_id (fk) => source.id (pk).
* Reverse mapping of _sourceToTargetKeyFields.
* Reverse mapping of _sourceToTargetKeyColumns.
*/
protected $_targetToSourceKeyColumns = array();
/** Whether to delete orphaned elements (when nulled out, i.e. $foo->other = null) */
protected $_deleteOrphans = false;
/**
* Constructor.
* Creates a new OneToOneMapping.

View File

@ -40,18 +40,6 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
const INHERITANCE_TYPE_SINGLE_TABLE = 'singleTable';
const INHERITANCE_TYPE_TABLE_PER_CLASS = 'tablePerClass';
/**
* Inheritance types enumeration.
*
* @var array
*/
protected static $_inheritanceTypes = array(
self::INHERITANCE_TYPE_NONE,
self::INHERITANCE_TYPE_JOINED,
self::INHERITANCE_TYPE_SINGLE_TABLE,
self::INHERITANCE_TYPE_TABLE_PER_CLASS
);
/* The Id generator types. TODO: belongs more in a DBAL class */
const GENERATOR_TYPE_AUTO = 'auto';
const GENERATOR_TYPE_SEQUENCE = 'sequence';
@ -59,18 +47,14 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
const GENERATOR_TYPE_IDENTITY = 'identity';
const GENERATOR_TYPE_NONE = 'none';
/**
* Id Generator types enumeration.
*
* @var array
*/
protected static $_generatorTypes = array(
self::GENERATOR_TYPE_AUTO,
self::GENERATOR_TYPE_SEQUENCE,
self::GENERATOR_TYPE_TABLE,
self::GENERATOR_TYPE_IDENTITY,
self::GENERATOR_TYPE_NONE
);
/* The Entity types */
// A regular entity is assumed to have persistent state that Doctrine should manage.
const ENTITY_TYPE_REGULAR = 'regular';
// A transient entity is ignored by Doctrine.
const ENTITY_TYPE_TRANSIENT = 'transient';
// A mapped superclass entity is itself not persisted by Doctrine but it's
// field & association mappings are inherited by subclasses.
const ENTITY_TYPE_MAPPED_SUPERCLASS = 'mappedSuperclass';
/**
* The name of the entity class.
@ -171,14 +155,11 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
* Marks the field as the primary key of the Entity. Multiple fields of an
* entity can have the id attribute, forming a composite key.
*
* - <b>generatorType</b> (string, optional, requires: id)
* The generation type used for the field. Optional. Can only be applied on
* fields that are marked with the 'id' attribute. The possible values are:
* auto, identity, sequence, table.
*
* - <b>generator</b> (array, optional, requires: generationType=table|sequence)
* The generator options for a table or sequence generator. Can only be applied
* on fields that have a generationType of 'table' or 'sequence'.
* - <b>idGenerator</b> (string, optional)
* Either: idGenerator => 'nameOfGenerator', usually only for TABLE/SEQUENCE generators
* Or: idGenerator => 'identity' or 'auto' or 'table' or 'sequence'
* Note that 'auto', 'table', 'sequence' and 'identity' are reserved names and
* therefore cant be used as a generator name!
*
* - <b>nullable</b> (boolean, optional)
* Whether the column is nullable. Defaults to TRUE.
@ -755,15 +736,16 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
if ( ! in_array($mapping['fieldName'], $this->_identifier)) {
$this->_identifier[] = $mapping['fieldName'];
}
if (isset($mapping['generatorType'])) {
if ( ! in_array($mapping['generatorType'], self::$_generatorTypes)) {
if (isset($mapping['idGenerator'])) {
if ( ! $this->_isIdGeneratorType($mapping['idGenerator'])) {
//TODO: check if the idGenerator specifies an existing generator by name
throw Doctrine_MappingException::invalidGeneratorType($mapping['generatorType']);
} else if (count($this->_identifier) > 1) {
throw Doctrine_MappingException::generatorNotAllowedWithCompositeId();
}
$this->_generatorType = $mapping['generatorType'];
$this->_generatorType = $mapping['idGenerator'];
}
// TODO: validate/complete 'generator' mapping
// TODO: validate/complete 'tableGenerator' and 'sequenceGenerator' mappings
// Check for composite key
if ( ! $this->_isIdentifierComposite && count($this->_identifier) > 1) {
@ -1170,7 +1152,7 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
. " must share the same inheritance mapping type and this type must be set"
. " in the root class of the hierarchy.");
}
if ( ! in_array($type, self::$_inheritanceTypes)) {
if ( ! $this->_isInheritanceType($type)) {
throw Doctrine_MappingException::invalidInheritanceType($type);
}
@ -1410,8 +1392,7 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
*/
public function setTableName($tableName)
{
$this->setTableOption('tableName', $this->_em->getConnection()
->getFormatter()->getTableName($tableName));
$this->setTableOption('tableName', $tableName);
}
/**
@ -1441,6 +1422,48 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
return true;
}
/**
* Checks whether the given name identifies an entity type.
*
* @param string $type
* @return boolean
*/
private function _isEntityType($type)
{
return $type == self::ENTITY_TYPE_REGULAR ||
$type == self::ENTITY_TYPE_MAPPED_SUPERCLASS ||
$type == self::ENTITY_TYPE_TRANSIENT;
}
/**
* Checks whether the given name identifies an inheritance type.
*
* @param string $type
* @return boolean
*/
private function _isInheritanceType($type)
{
return $type == self::INHERITANCE_TYPE_NONE ||
$type == self::INHERITANCE_TYPE_SINGLE_TABLE ||
$type == self::INHERITANCE_TYPE_JOINED ||
$type == self::INHERITANCE_TYPE_TABLE_PER_CLASS;
}
/**
* Checks whether the given name identifies an id generator type.
*
* @param string $type
* @return boolean
*/
private function _isIdGeneratorType($type)
{
return $type == self::GENERATOR_TYPE_AUTO ||
$type == self::GENERATOR_TYPE_IDENTITY ||
$type == self::GENERATOR_TYPE_SEQUENCE ||
$type == self::GENERATOR_TYPE_TABLE ||
$type == self::GENERATOR_TYPE_NONE;
}
/**
* Adds a one-to-one association mapping.
*

View File

@ -32,6 +32,7 @@
* @link www.phpdoctrine.
* @since 1.0
* @version $Revision$
* @todo Remove or put in a separate package and look for a maintainer.
*/
class Doctrine_Compiler
{

View File

@ -40,7 +40,7 @@ class Doctrine_Configuration
* @var array
*/
private $_attributes = array(
'quoteIdentifier' => false,
'quoteIdentifiers' => false,
'indexNameFormat' => '%s_idx',
'sequenceNameFormat' => '%s_seq',
'tableNameFormat' => '%s',
@ -85,7 +85,7 @@ class Doctrine_Configuration
*/
public function get($name)
{
if ( ! $this->hasAttribute($name)) {
if ( ! $this->has($name)) {
throw Doctrine_Configuration_Exception::unknownAttribute($name);
}
if ($this->_attributes[$name] === $this->_nullObject) {
@ -102,7 +102,7 @@ class Doctrine_Configuration
*/
public function set($name, $value)
{
if ( ! $this->hasAttribute($name)) {
if ( ! $this->has($name)) {
throw Doctrine_Configuration_Exception::unknownAttribute($name);
}
// TODO: do some value checking depending on the attribute

View File

@ -21,12 +21,10 @@
#namespace Doctrine::DBAL::Connections;
#use Doctrine::Common::Configuration;
/**
* Doctrine_Connection
*
* A wrapper layer on top of PDO / Doctrine_Adapter
*
* Doctrine_Connection is the heart of any Doctrine based application.
* A thin connection wrapper on top of PDO.
*
* 1. Event listeners
* An easy to use, pluggable eventlistener architecture. Aspects such as
@ -41,13 +39,6 @@
* 3. Convenience methods
* Doctrine_Connection provides many convenience methods such as fetchAll(), fetchOne() etc.
*
* 4. Modular structure
* Higher level functionality such as schema importing, exporting, sequence handling etc.
* is divided into modules. For a full list of connection modules see
* Doctrine_Connection::$_modules
*
* @package Doctrine
* @subpackage Connection
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
@ -70,7 +61,7 @@
* 'masters' => array(...),
* 'masterConnectionResolver' => new MyMasterConnectionResolver()
*
* Doctrine::DBAL could ship with a simple standard resolver that uses a primitive
* Doctrine::DBAL could ship with a simple standard broker that uses a primitive
* round-robin approach to distribution. User can provide its own resolvers.
*/
abstract class Doctrine_Connection implements Countable
@ -85,14 +76,14 @@ abstract class Doctrine_Connection implements Countable
/**
* The Configuration.
*
* @var Configuration
* @var Doctrine::Common::Configuration
*/
protected $_config;
/**
* The EventManager.
*
* @var EventManager
* @var Doctrine::Commom::EventManager
*/
protected $_eventManager;
@ -125,12 +116,11 @@ abstract class Doctrine_Connection implements Countable
protected $_isConnected = false;
/**
* An array containing all features this driver supports, keys representing feature
* names and values as one of the following (true, false, 'emulated').
* Boolean flag that indicates whether identifiers should get quoted.
*
* @var array $supported
* @var boolean
*/
protected $supported = array();
protected $_quoteIdentifiers;
/**
* The connection properties.
@ -164,6 +154,7 @@ abstract class Doctrine_Connection implements Countable
* List of all available drivers.
*
* @var array $availableDrivers
* @todo Move elsewhere.
*/
private static $_availableDrivers = array(
'Mysql', 'Pgsql', 'Oracle', 'Informix', 'Mssql', 'Sqlite', 'Firebird'
@ -176,51 +167,17 @@ abstract class Doctrine_Connection implements Countable
*/
protected $_queryCount = 0;
/*
* ----------- Mixed attributes (need to split up) ---------------
*/
/**
* @var array $modules an array containing all modules
* transaction Doctrine_Transaction driver, handles savepoint and transaction isolation abstraction
* The DatabasePlatform object that provides information about the
* database platform used by the connection.
*
* expression Doctrine_Expression driver, handles expression abstraction
*
* dataDict Doctrine_DataDict driver, handles datatype abstraction
*
* export Doctrine_Export driver, handles db structure modification abstraction (contains
* methods such as alterTable, createConstraint etc.)
* import Doctrine_Import driver, handles db schema reading
*
* sequence Doctrine_Sequence driver, handles sequential id generation and retrieval
*
* unitOfWork Doctrine_Connection_UnitOfWork handles many orm functionalities such as object
* deletion and saving
*
* formatter Doctrine_Formatter handles data formatting, quoting and escaping
*
* @see Doctrine_Connection::__get()
* @see Doctrine_DataDict
* @see Doctrine_Expression
* @see Doctrine_Export
* @see Doctrine_Transaction
* @see Doctrine_Sequence
* @see Doctrine_Connection_UnitOfWork
* @see Doctrine_Formatter
* @var Doctrine::DBAL::Platforms::DatabasePlatform
*/
private $modules = array('transaction' => false,
'expression' => false,
'dataDict' => false,
'export' => false,
'import' => false,
'sequence' => false,
'formatter' => false,
'util' => false,
);
protected $_databasePlatform;
/**
* Constructor.
* Creates a new Connection.
*
* @param array $params The connection parameters.
*/
@ -236,7 +193,7 @@ abstract class Doctrine_Connection implements Countable
/**
* Sets the Configuration used by the Connection.
*
* @param Doctrine_Configuration $config
* @param Doctrine::Common::Configuration $config
*/
public function setConfiguration(Doctrine_Configuration $config)
{
@ -259,7 +216,7 @@ abstract class Doctrine_Connection implements Countable
/**
* Sets the EventManager used by the Connection.
*
* @param Doctrine_EventManager $eventManager
* @param Doctrine::Common::EventManager $eventManager
*/
public function setEventManager(Doctrine_EventManager $eventManager)
{
@ -269,7 +226,7 @@ abstract class Doctrine_Connection implements Countable
/**
* Gets the EventManager used by the Connection.
*
* @return EventManager
* @return Doctrine::Common::EventManager
*/
public function getEventManager()
{
@ -279,6 +236,13 @@ abstract class Doctrine_Connection implements Countable
return $this->_eventManager;
}
/**
* Enter description here...
*
* @param unknown_type $name
* @return unknown
* @todo Remove. Move properties to DatabasePlatform.
*/
public function getProperty($name)
{
if ( ! isset($this->properties[$name])) {
@ -288,7 +252,8 @@ abstract class Doctrine_Connection implements Countable
}
/**
* returns an array of available PDO drivers
* Returns an array of available PDO drivers
* @todo Move elsewhere.
*/
public static function getAvailableDrivers()
{
@ -296,7 +261,6 @@ abstract class Doctrine_Connection implements Countable
}
/**
* getName
* returns the name of this driver
*
* @return string the name of this driver
@ -307,8 +271,6 @@ abstract class Doctrine_Connection implements Countable
}
/**
* setName
*
* Sets the name of the connection
*
* @param string $name
@ -329,18 +291,6 @@ abstract class Doctrine_Connection implements Countable
return $this->_driverName;
}
/**
* returns the database handler which this connection uses
*
* @return PDO the database handler
* @deprecated
*/
public function getDbh()
{
$this->connect();
return $this->_pdo;
}
/**
* Gets the PDO handle used by the connection.
*
@ -422,18 +372,6 @@ abstract class Doctrine_Connection implements Countable
$this->_queryCount++;
}
/**
* Checks whether a certain feature is supported.
*
* @param string $feature the name of the feature
* @return boolean whether or not this drivers supports given feature
*/
public function supports($feature)
{
return (isset($this->supported[$feature]) &&
($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
@ -638,20 +576,29 @@ abstract class Doctrine_Connection implements Countable
*/
public function quoteIdentifier($str, $checkOption = true)
{
if (is_null($this->_quoteIdentifiers)) {
$this->_quoteIdentifiers = $this->_config->get('quoteIdentifiers');
}
if ( ! $this->_quoteIdentifiers) {
return $str;
}
// quick fix for the identifiers that contain a dot
if (strpos($str, '.')) {
$e = explode('.', $str);
return $this->getFormatter()->quoteIdentifier($e[0], $checkOption) . '.'
. $this->getFormatter()->quoteIdentifier($e[1], $checkOption);
return $this->quoteIdentifier($e[0]) . '.'
. $this->quoteIdentifier($e[1]);
}
return $this->getFormatter()->quoteIdentifier($str, $checkOption);
$q = $this->properties['identifier_quoting'];
$str = str_replace($q['end'], $q['escape'] . $q['end'], $str);
return $q['start'] . $str . $q['end'];
}
/**
* convertBooleans
* some drivers need the boolean values to be converted into integers
* when using DQL API
* Some drivers need the boolean values to be converted into integers
* when using DQL API.
*
* This method takes care of that conversion
*
@ -660,7 +607,18 @@ abstract class Doctrine_Connection implements Countable
*/
public function convertBooleans($item)
{
return $this->getFormatter()->convertBooleans($item);
if (is_array($item)) {
foreach ($item as $k => $value) {
if (is_bool($value)) {
$item[$k] = (int) $value;
}
}
} else {
if (is_bool($item)) {
$item = (int) $item;
}
}
return $item;
}
/**
@ -674,6 +632,45 @@ abstract class Doctrine_Connection implements Countable
{
return $this->_pdo->quote($input, $type);
}
/**
* quote
* quotes given input parameter
*
* @param mixed $input parameter to be quoted
* @param string $type
* @return mixed
*/
/*public function quote($input, $type = null)
{
if ($type == null) {
$type = gettype($input);
}
switch ($type) {
case 'integer':
case 'enum':
case 'boolean':
case 'double':
case 'float':
case 'bool':
case 'decimal':
case 'int':
return $input;
case 'array':
case 'object':
$input = serialize($input);
case 'date':
case 'time':
case 'timestamp':
case 'string':
case 'char':
case 'varchar':
case 'text':
case 'gzip':
case 'blob':
case 'clob':
return $this->conn->quote($input);
}
}*/
/**
* Set the date/time format for the current connection
@ -695,7 +692,7 @@ abstract class Doctrine_Connection implements Countable
*/
public function fetchAll($statement, array $params = array())
{
return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_ASSOC);
return $this->execute($statement, $params)->fetchAll(PDO::FETCH_ASSOC);
}
/**
@ -720,7 +717,7 @@ abstract class Doctrine_Connection implements Countable
*/
public function fetchRow($statement, array $params = array())
{
return $this->execute($statement, $params)->fetch(Doctrine::FETCH_ASSOC);
return $this->execute($statement, $params)->fetch(PDO::FETCH_ASSOC);
}
/**
@ -732,7 +729,7 @@ abstract class Doctrine_Connection implements Countable
*/
public function fetchArray($statement, array $params = array())
{
return $this->execute($statement, $params)->fetch(Doctrine::FETCH_NUM);
return $this->execute($statement, $params)->fetch(PDO::FETCH_NUM);
}
/**
@ -745,7 +742,7 @@ abstract class Doctrine_Connection implements Countable
*/
public function fetchColumn($statement, array $params = array(), $colnum = 0)
{
return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_COLUMN, $colnum);
return $this->execute($statement, $params)->fetchAll(PDO::FETCH_COLUMN, $colnum);
}
/**
@ -757,7 +754,7 @@ abstract class Doctrine_Connection implements Countable
*/
public function fetchAssoc($statement, array $params = array())
{
return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_ASSOC);
return $this->execute($statement, $params)->fetchAll(PDO::FETCH_ASSOC);
}
/**
@ -769,7 +766,7 @@ abstract class Doctrine_Connection implements Countable
*/
public function fetchBoth($statement, array $params = array())
{
return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_BOTH);
return $this->execute($statement, $params)->fetchAll(PDO::FETCH_BOTH);
}
/**
@ -782,17 +779,16 @@ abstract class Doctrine_Connection implements Countable
$this->connect();
try {
$event = new Doctrine_Event($this, Doctrine_Event::CONN_PREPARE, $statement);
$this->getAttribute(Doctrine::ATTR_LISTENER)->prePrepare($event);
//$event = new Doctrine_Event($this, Doctrine_Event::CONN_PREPARE, $statement);
//$this->getAttribute(Doctrine::ATTR_LISTENER)->prePrepare($event);
$stmt = false;
if ( ! $event->skipOperation) {
//if ( ! $event->skipOperation) {
$stmt = $this->_pdo->prepare($statement);
}
//}
$this->getAttribute(Doctrine::ATTR_LISTENER)->postPrepare($event);
//$this->getAttribute(Doctrine::ATTR_LISTENER)->postPrepare($event);
return new Doctrine_Connection_Statement($this, $stmt);
} catch (PDOException $e) {
@ -801,7 +797,7 @@ abstract class Doctrine_Connection implements Countable
}
/**
* queries the database with limit and offset
* Queries the database with limit and offset
* added to the query and returns a Doctrine_Connection_Statement object
*
* @param string $query
@ -847,15 +843,14 @@ abstract class Doctrine_Connection implements Countable
$stmt->execute($params);
return $stmt;
} else {
$event = new Doctrine_Event($this, Doctrine_Event::CONN_QUERY, $query, $params);
//$event = new Doctrine_Event($this, Doctrine_Event::CONN_QUERY, $query, $params);
//$this->getAttribute(Doctrine::ATTR_LISTENER)->preQuery($event);
$this->getAttribute(Doctrine::ATTR_LISTENER)->preQuery($event);
if ( ! $event->skipOperation) {
//if ( ! $event->skipOperation) {
$stmt = $this->_pdo->query($query);
$this->_queryCount++;
}
$this->getAttribute(Doctrine::ATTR_LISTENER)->postQuery($event);
//}
//$this->getAttribute(Doctrine::ATTR_LISTENER)->postQuery($event);
return $stmt;
}
@ -881,15 +876,14 @@ abstract class Doctrine_Connection implements Countable
return $stmt->rowCount();
} else {
$event = new Doctrine_Event($this, Doctrine_Event::CONN_EXEC, $query, $params);
//$event = new Doctrine_Event($this, Doctrine_Event::CONN_EXEC, $query, $params);
//$this->getAttribute(Doctrine::ATTR_LISTENER)->preExec($event);
$this->getAttribute(Doctrine::ATTR_LISTENER)->preExec($event);
if ( ! $event->skipOperation) {
//if ( ! $event->skipOperation) {
$count = $this->_pdo->exec($query);
$this->_queryCount++;
}
$this->getAttribute(Doctrine::ATTR_LISTENER)->postExec($event);
//}
//$this->getAttribute(Doctrine::ATTR_LISTENER)->postExec($event);
return $count;
}
@ -902,6 +896,7 @@ abstract class Doctrine_Connection implements Countable
*
*
* @return string
* @todo Rather orm stuff
*/
public function modifyLimitQuery($query, $limit = false, $offset = false, $isManip = false)
{
@ -913,6 +908,7 @@ abstract class Doctrine_Connection implements Countable
* context of the limit-subquery algorithm.
*
* @return string
* @todo Rather ORM stuff
*/
public function modifyLimitSubquery(Doctrine_Table $rootTable, $query, $limit = false,
$offset = false, $isManip = false)
@ -965,7 +961,6 @@ abstract class Doctrine_Connection implements Countable
//this->getAttribute(Doctrine::ATTR_LISTENER)->preClose($event);
$this->clear();
unset($this->_pdo);
$this->_isConnected = false;
@ -983,7 +978,6 @@ abstract class Doctrine_Connection implements Countable
}
/**
* errorCode
* Fetch the SQLSTATE associated with the last operation on the database handle
*
* @return integer
@ -996,7 +990,6 @@ abstract class Doctrine_Connection implements Countable
}
/**
* errorInfo
* Fetch extended error information associated with the last operation on the database handle
*
* @return array
@ -1009,8 +1002,6 @@ abstract class Doctrine_Connection implements Countable
}
/**
* lastInsertId
*
* Returns the ID of the last inserted row, or the last value from a sequence object,
* depending on the underlying driver.
*
@ -1026,7 +1017,6 @@ abstract class Doctrine_Connection implements Countable
}
/**
* beginTransaction
* Start a transaction or set a savepoint.
*
* if trying to set a savepoint and there is no active transaction
@ -1044,8 +1034,7 @@ abstract class Doctrine_Connection implements Countable
}
/**
* commit
* Commit the database changes done during a transaction that is in
* Commits the database changes done during a transaction that is in
* progress or release a savepoint. This function may only be called when
* auto-committing is disabled, otherwise it will fail.
*
@ -1121,8 +1110,6 @@ abstract class Doctrine_Connection implements Countable
}
/**
* dropDatabase
*
* Method for dropping the database for the connection instance
*
* @return mixed Will return an instance of the exception thrown if the drop
@ -1145,6 +1132,107 @@ abstract class Doctrine_Connection implements Countable
}
}
/**
* Quotes pattern (% and _) characters in a string)
*
* EXPERIMENTAL
*
* WARNING: this function is experimental and may change signature at
* any time until labelled as non-experimental
*
* @param string the input string to quote
*
* @return string quoted string
*/
protected function _escapePattern($text)
{
return $text;
/*if ( ! $this->string_quoting['escape_pattern']) {
return $text;
}
$tmp = $this->conn->string_quoting;
$text = str_replace($tmp['escape_pattern'],
$tmp['escape_pattern'] .
$tmp['escape_pattern'], $text);
foreach ($this->wildcards as $wildcard) {
$text = str_replace($wildcard, $tmp['escape_pattern'] . $wildcard, $text);
}
return $text;*/
}
/**
* Removes any formatting in an sequence name using the 'seqname_format' option
*
* @param string $sqn string that containts name of a potential sequence
* @return string name of the sequence with possible formatting removed
*/
protected function _fixSequenceName($sqn)
{
$seqPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT)).'$/i';
$seqName = preg_replace($seqPattern, '\\1', $sqn);
if ($seqName && ! strcasecmp($sqn, $this->getSequenceName($seqName))) {
return $seqName;
}
return $sqn;
}
/**
* Removes any formatting in an index name using the 'idxname_format' option
*
* @param string $idx string that containts name of anl index
* @return string name of the index with possible formatting removed
*/
protected function _fixIndexName($idx)
{
$indexPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT)).'$/i';
$indexName = preg_replace($indexPattern, '\\1', $idx);
if ($indexName && ! strcasecmp($idx, $this->getIndexName($indexName))) {
return $indexName;
}
return $idx;
}
/**
* adds sequence name formatting to a sequence name
*
* @param string name of the sequence
* @return string formatted sequence name
*/
protected function _getSequenceName($sqn)
{
return sprintf($this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT),
preg_replace('/[^a-z0-9_\$.]/i', '_', $sqn));
}
/**
* adds index name formatting to a index name
*
* @param string name of the index
* @return string formatted index name
*/
protected function _getIndexName($idx)
{
return sprintf($this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT),
preg_replace('/[^a-z0-9_\$]/i', '_', $idx));
}
/**
* adds table name formatting to a table name
*
* @param string name of the table
* @return string formatted table name
*/
protected function _getTableName($table)
{
return $table;
/*
return sprintf($this->conn->getAttribute(Doctrine::ATTR_TBLNAME_FORMAT),
$table);*/
}
/**
* returns a string representation of this object
* @return string
@ -1159,7 +1247,6 @@ abstract class Doctrine_Connection implements Countable
*/
/**
* getAttribute
* retrieves a database connection attribute
*
* @param integer $attribute
@ -1182,7 +1269,7 @@ abstract class Doctrine_Connection implements Countable
return $this->modules['formatter'];
}
public function getSequenceModule()
public function getSequenceManager()
{
if ( ! $this->modules['sequence']) {
$class = "Doctrine_Sequence_" . $this->_driverName;

View File

@ -69,7 +69,6 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
}
/**
* quoteIdentifier
* Quote a string so it can be safely used as a table / column name
*
* Quoting style depends on which database driver is being used.

View File

@ -90,7 +90,6 @@ class Doctrine_Connection_UnitOfWork
* entities need to be written to the database.
*
* @var Doctrine::ORM::Internal::CommitOrderCalculator
* @todo Implementation. Replace buildFlushTree().
*/
protected $_commitOrderCalculator;
@ -563,6 +562,13 @@ class Doctrine_Connection_UnitOfWork
// In both cases we must commit the inserts instantly.
//TODO: Isnt it enough to only execute the inserts instead of full flush?
$this->commit();
/* The following may be better:
$commitOrder = $this->_getCommitOrder($insertNow);
foreach ($commitOrder as $class) {
$this->_executeInserts($class);
}
//... remove them from _newEntities, or dont store them there in the first place
*/
}
}
@ -593,11 +599,12 @@ class Doctrine_Connection_UnitOfWork
$this->_newEntities[$entity->getOid()] = $entity;
} else if ( ! $class->usesIdGenerator()) {
$insertNow[$entity->getOid()] = $entity;
$this->_newEntities[$entity->getOid()] = $entity;
//...
} else if ($class->isIdGeneratorSequence()) {
// Get the next sequence number
//TODO: sequence name?
$id = $this->_em->getConnection()->getSequenceModule()->nextId("foo");
$id = $this->_em->getConnection()->getSequenceManager()->nextId("foo");
$entity->set($class->getSingleIdentifierFieldName(), $id);
$this->registerNew($entity);
} else {

View File

@ -32,6 +32,7 @@
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @todo Merge all the DataDict classes into the appropriate DBAL DatabasePlatform classes.
*/
class Doctrine_DataDict extends Doctrine_Connection_Module
{

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_DataDict');
/**
* @package Doctrine
* @subpackage DataDict

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_DataDict');
/**
* @package Doctrine
* @subpackage DataDict

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_DataDict');
/**
* @package Doctrine
* @subpackage DataDict

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_DataDict');
/**
* @package Doctrine
* @subpackage DataDict

View File

@ -29,8 +29,6 @@
* are marked INTERNAL: and begin with an underscore "_" to indicate that they
* ideally would not be public and to minimize naming collisions.
*
* @package Doctrine
* @subpackage Entity
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
@ -75,8 +73,8 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
/**
* A removed Entity instance is an instance with a persistent identity,
* associated with an EntityManager, that is scheduled for removal from the
* database.
* associated with an EntityManager, whose persistent state has been
* deleted (or is scheduled for deletion).
*/
const STATE_DELETED = 4;
@ -111,7 +109,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
/**
* The class descriptor.
*
* @var ClassMetadata
* @var Doctrine::ORM::ClassMetadata
*/
private $_class;
@ -162,7 +160,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
/**
* The EntityManager that is responsible for the persistence of the entity.
*
* @var Doctrine_EntityManager
* @var Doctrine::ORM::EntityManager
*/
private $_em;
@ -206,37 +204,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
return $this->_oid;
}
/**
* setDefaultValues
* sets the default values for records internal data
*
* @param boolean $overwrite whether or not to overwrite the already set values
* @return boolean
* @todo Job of EntityManager.
* @deprecated
* Setting object-level default field values is much more natural to do in
* the constructor and database-level default values are set by the database.
*/
/*public function assignDefaultValues($overwrite = false)
{
if ( ! $this->_class->hasDefaultValues()) {
return false;
}
foreach ($this->_data as $column => $value) {
$default = $this->_class->getDefaultValueOf($column);
if ($default === null) {
continue;
}
if ($value === Doctrine_Null::$INSTANCE || $overwrite) {
$this->_data[$column] = $default;
$this->_modified[] = $column;
$this->_state = Doctrine_Entity::STATE_TDIRTY;
}
}
}*/
/**
* Hydrates this object from given array
*
@ -277,10 +244,10 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
/**
* INTERNAL:
*/
final public function _setIdentifier(array $identifier)
/*final public function _setIdentifier(array $identifier)
{
$this->_id = $identifier;
}
}*/
/**
* Serializes the entity.
@ -298,10 +265,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
$vars = get_object_vars($this);
unset($vars['_references']);
unset($vars['_mapper']);
unset($vars['_errorStack']);
unset($vars['_filter']);
unset($vars['_node']);
unset($vars['_em']);
//$name = (array)$this->_table->getIdentifier();
@ -417,7 +380,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
}
/**
* refresh internal data from the database
* Refresh internal data from the database
*
* @param bool $deep If true, fetch also current relations. Caution: this deletes
* any aggregated values you may have queried beforee
@ -426,7 +389,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
* this record represents does not exist anymore)
* @return boolean
* @todo Implementation to EntityManager.
* @todo Move to ActiveEntity (extends Entity).
* @todo Move to ActiveEntity (extends Entity). Implementation to EntityManager.
*/
public function refresh($deep = false)
{
@ -468,40 +431,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
return $this;
}
/**
* refresh
* refres data of related objects from the database
*
* @param string $name name of a related component.
* if set, this method only refreshes the specified related component
*
* @return Doctrine_Entity this object
* @todo Implementation to EntityManager.
* @todo ActiveEntity method.
*/
/*public function refreshRelated($name = null)
{
if (is_null($name)) {
foreach ($this->_class->getRelations() as $rel) {
$this->_references[$rel->getAlias()] = $rel->fetchRelatedFor($this);
}
} else {
$rel = $this->_class->getRelation($name);
$this->_references[$name] = $rel->fetchRelatedFor($this);
}
}*/
/**
* clearRelated
* unsets all the relationships this object has
*
* (references to related objects still remain on Table objects)
*/
/*public function clearRelated()
{
$this->_references = array();
}*/
/**
* Gets the current field values.
*
@ -512,16 +441,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
return $this->_data;
}
/**
* INTERNAL:
* For internal hydration purposes only.
*/
/*final public function _setData(array $data)
{
$this->_data = $data;
$this->_extractIdentifier();
}*/
/**
* INTERNAL: (Usage from within extending classes is intended)
*
@ -534,9 +453,8 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
* @param $name name of the property
* @throws Doctrine_Entity_Exception if trying to get an unknown field
* @return mixed
* @todo Rename to _get()
*/
final public function _rawGet($fieldName)
final public function _get($fieldName)
{
if (isset($this->_data[$fieldName])) {
return $this->_rawGetField($fieldName);
@ -559,9 +477,8 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
* @param $name name of the field
* @throws Doctrine_Entity_Exception if trying to get an unknown field
* @return mixed
* @todo Rename to _set
*/
final public function _rawSet($fieldName, $value)
final public function _set($fieldName, $value)
{
if (isset($this->_data[$fieldName])) {
return $this->_rawSetField($fieldName, $value);
@ -578,7 +495,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
*
* NOTE: Use of this method from outside the scope of an extending class
* is strongly discouraged. This method does NOT check whether the field
* exists. _rawGet() in extending classes should be preferred.
* exists. _get() in extending classes should be preferred.
*
* @param string $fieldName
* @return mixed
@ -598,7 +515,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
*
* NOTE: Use of this method from outside the scope of an extending class
* is strongly discouraged. This method does NOT check whether the field
* exists. _rawSet() in extending classes should be preferred.
* exists. _set() in extending classes should be preferred.
*
* @param string $fieldName
* @param mixed $value
@ -616,7 +533,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
* is strongly discouraged. This method does NOT check whether the reference
* exists.
*
* @param unknown_type $fieldName
* @param string $fieldName
* @todo Rename to _unsafeGetReference().
*/
final public function _rawGetReference($fieldName)
@ -631,8 +548,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
* INTERNAL:
* Sets a reference to another Entity.
*
* NOTE: Use of this method from outside the scope of an extending class
* is strongly discouraged.
* NOTE: Use of this method is strongly discouraged for user-code.
*
* @param string $fieldName
* @param mixed $value
@ -672,7 +588,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
if ($rel instanceof Doctrine_Relation_LocalKey) {
$idFieldNames = $value->getTable()->getIdentifier();
if ( ! empty($foreignFieldName) && $foreignFieldName != $idFieldNames[0]) {
$this->set($localFieldName, $value->_rawGet($foreignFieldName));
$this->set($localFieldName, $value->_get($foreignFieldName));
} else {
$this->set($localFieldName, $value);
}
@ -689,23 +605,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
$this->_references[$name] = $value;
}
/**
* loads all the uninitialized properties from the database.
*
* @return boolean
* @todo ActiveRecord method.
*/
/*public function load()
{
// only load the data from database if the Doctrine_Entity is in proxy state
if ($this->_state == Doctrine_Entity::STATE_PROXY) {
$this->refresh();
$this->_state = Doctrine_Entity::STATE_CLEAN;
return true;
}
return false;
}*/
/**
* Generic getter.
*
@ -903,7 +802,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
/**
* Saves the current state of the entity into the database.
* This method also saves associated entities.
*
* @param Doctrine_Connection $conn optional connection parameter
* @return void
@ -942,18 +840,14 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
}
/**
* Gets the names and values of all fields that have been modified since
* the entity was last synch'd with the database.
* INTERNAL:
* Gets the changeset of the entities persistent state.
*
* @return array
*/
final public function getModifiedFields()
final public function _getChangeSet()
{
$a = array();
foreach ($this->_modified as $k => $v) {
$a[$v] = $this->_data[$v];
}
return $a;
//return $this->_changeSet;
}
/**
@ -964,6 +858,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
* @return array
* @todo What about a little bit more expressive name? getPreparedData?
* @todo Does not look like the best place here ...
* @todo Prop: Move to EntityPersister. There call _getChangeSet() and apply this logic.
*/
final public function getPrepared(array $array = array())
{
@ -997,18 +892,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
$dataSet[$field] = $this->_class->enumIndex($field, $this->_data[$field]);
break;
default:
/*if ($this->_data[$field] instanceof Doctrine_Entity) {
// FIXME: composite key support
$ids = $this->_data[$field]->identifier();
$id = count($ids) > 0 ? array_pop($ids) : null;
$this->_data[$field] = $id;
}*/
/** TODO:
if ($this->_data[$v] === null) {
throw new Doctrine_Record_Exception('Unexpected null value.');
}
*/
$dataSet[$field] = $this->_data[$field];
}
}
@ -1184,18 +1067,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
}
}
/**
* Checks whether the entity already has a persistent state.
*
* @return boolean TRUE if the object is managed and has persistent state, FALSE otherwise.
* @deprecated
*/
/*public function exists()
{
return ($this->_state !== Doctrine_Entity::STATE_TCLEAN &&
$this->_state !== Doctrine_Entity::STATE_TDIRTY);
}*/
/**
* Checks whether the entity already has a persistent state.
*
@ -1218,42 +1089,15 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
}
/**
* method for checking existence of properties and Doctrine_Entity references
* Deletes the persistent state of the entity.
*
* @param mixed $name name of the property or reference
* @return boolean
* @todo Method name does not reflect the purpose.
*/
/*public function hasRelation($fieldName)
{
if (isset($this->_data[$fieldName]) || isset($this->_id[$fieldName])) {
return true;
}
return $this->_class->hasRelation($fieldName);
}*/
/**
* getIterator
* @return Doctrine_Record_Iterator a Doctrine_Record_Iterator that iterates through the data
* @todo Really needed/useful?
*/
/*public function getIterator()
{
return new Doctrine_Record_Iterator($this);
}*/
/**
* Deletes the entity.
*
* Triggered events: onPreDelete, onDelete.
*
* @return boolean true on success, false on failure
* @return boolean TRUE on success, FALSE on failure.
* @todo ActiveRecord method.
*/
public function delete(Doctrine_Connection $conn = null)
public function delete()
{
// TODO: Forward to EntityManager. There: registerRemoved() on UnitOfWork
return $this->_em->remove($this, $conn);
return $this->_em->remove($this);
}
/**
@ -1333,7 +1177,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
* hasRefence
* @param string $name
* @return boolean
* @todo Better name? hasAssociation() ?
* @todo Better name? hasAssociation() ? Remove?
*/
final public function hasReference($name)
{
@ -1345,6 +1189,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
*
* @param string $name
* @throws Doctrine_Record_Exception if trying to get an unknown related component
* @todo Better name? Remove?
*/
final public function obtainReference($name)
{
@ -1371,59 +1216,13 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
*
* @param string $alias
* @param Doctrine_Access $coll
* @todo Name? Remove?
*/
final public function _setRelated($alias, Doctrine_Access $coll)
{
$this->_references[$alias] = $coll;
}
/**
* getter for node assciated with this record
*
* @return mixed if tree returns Doctrine_Node otherwise returns false
* @todo Should go to the NestedSet Behavior plugin.
*/
/*public function getNode()
{
if ( ! $this->_class->isTree()) {
return false;
}
if ( ! isset($this->_node)) {
$this->_node = Doctrine_Node::factory($this,
$this->getTable()->getOption('treeImpl'),
$this->getTable()->getOption('treeOptions'));
}
return $this->_node;
}*/
/**
* revert
* reverts this record to given version, this method only works if versioning plugin
* is enabled
*
* @throws Doctrine_Record_Exception if given version does not exist
* @param integer $version an integer > 1
* @return Doctrine_Entity this object
* @todo Should go to the Versionable plugin.
*/
public function revert($version)
{
$data = $this->_class
->getBehavior('Doctrine_Template_Versionable')
->getAuditLog()
->getVersion($this, $version);
if ( ! isset($data[0])) {
throw new Doctrine_Record_Exception('Version ' . $version . ' does not exist!');
}
$this->_data = $data[0];
return $this;
}
/**
* Removes links from this record to given records
* if no ids are given, it removes all links
@ -1550,51 +1349,6 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
return $this;
}
/**
* __call
* this method is a magic method that is being used for method overloading
*
* the function of this method is to try to find given method from the templates
* this record is using and if it finds given method it will execute it
*
* So, in sense, this method replicates the usage of mixins (as seen in some programming languages)
*
* @param string $method name of the method
* @param array $args method arguments
* @return mixed the return value of the given method
* @todo In order to avoid name clashes and provide a more robust implementation
* we decided that all behaviors should be accessed through getBehavior($name)
* before they're used.
*/
/*public function __call($method, $args)
{
if (($behavior = $this->_class->getBehaviorForMethod($method)) !== false) {
$behavior->setInvoker($this);
return call_user_func_array(array($behavior, $method), $args);
}
foreach ($this->_class->getBehaviors() as $behavior) {
if (method_exists($behavior, $method)) {
$behavior->setInvoker($this);
$this->_class->addBehaviorMethod($method, $behavior);
return call_user_func_array(array($behavior, $method), $args);
}
}
throw new Doctrine_Record_Exception(sprintf('Unknown method %s::%s', get_class($this), $method));
}*/
/**
* used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE
*
* @todo Should go to the NestedSet Behavior plugin.
*/
/*public function deleteNode()
{
$this->getNode()->delete();
}*/
/**
* Gets the ClassMetadata object that describes the entity class.
*
@ -1607,7 +1361,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
/**
* Gets the EntityManager that is responsible for the persistence of
* the Entity.
* the entity.
*
* @return Doctrine::ORM::EntityManager
*/
@ -1668,5 +1422,4 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
$this->_references = array();
}
}
}

View File

@ -403,6 +403,27 @@ class Doctrine_EntityManager
$this->_unitOfWork->delete($entity);
}
/**
* Refreshes the persistent state of the entity from the database.
*
* @param Doctrine_Entity $entity
*/
public function refresh(Doctrine_Entity $entity)
{
//...
}
/**
* Creates a copy of the given entity. Can create a shallow or a deep copy.
*
* @param Doctrine::ORM::Entity $entity The entity to copy.
* @return Doctrine::ORM::Entity The new entity.
*/
public function copy(Doctrine_Entity $entity, $deep = false)
{
//...
}
/**
* Gets the repository for an Entity.
*
@ -467,12 +488,6 @@ class Doctrine_EntityManager
$entity = new $className;
}
/*if (count($data) < $classMetadata->getMappedColumnCount()) {
$entity->_state(Doctrine_Entity::STATE_PROXY);
} else {
$entity->_state(Doctrine_Entity::STATE_CLEAN);
}*/
return $entity;
}
@ -523,20 +538,10 @@ class Doctrine_EntityManager
}
}
/**
* Gets the UnitOfWork used by the EntityManager.
*
* @return UnitOfWork
*/
/*public function getUnitOfWork()
{
return $this->_unitOfWork;
}*/
/**
* Gets the EventManager used by the EntityManager.
*
* @return EventManager
* @return Doctrine::Common::EventManager
*/
public function getEventManager()
{
@ -546,7 +551,7 @@ class Doctrine_EntityManager
/**
* Sets the EventManager used by the EntityManager.
*
* @param Doctrine_EventManager $eventManager
* @param Doctrine::Common::EventManager $eventManager
*/
public function setEventManager(Doctrine_EventManager $eventManager)
{
@ -556,7 +561,7 @@ class Doctrine_EntityManager
/**
* Sets the Configuration used by the EntityManager.
*
* @param Doctrine_Configuration $config
* @param Doctrine::Common::Configuration $config
*/
public function setConfiguration(Doctrine_Configuration $config)
{
@ -566,7 +571,7 @@ class Doctrine_EntityManager
/**
* Gets the Configuration used by the EntityManager.
*
* @return Configuration
* @return Doctrine::Common::Configuration
*/
public function getConfiguration()
{

View File

@ -19,20 +19,22 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Persisters;
/**
*
* Base class for all EntityPersisters.
*
* @author Roman Borschel <roman@code-factory.org>
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision: 3406 $
* @link www.phpdoctrine.org
* @since 2.0
* @todo Rename to AbstractEntityPersister
*/
abstract class Doctrine_EntityPersister_Abstract
{
/**
* The names of all the fields that are available on entities created by this mapper.
* The names of all the fields that are available on entities.
*/
protected $_fieldNames = array();
@ -44,9 +46,11 @@ abstract class Doctrine_EntityPersister_Abstract
protected $_classMetadata;
/**
* The name of the domain class this mapper is used for.
* The name of the Entity the persister is used for.
*
* @var string
*/
protected $_domainClassName;
protected $_entityName;
/**
* The Doctrine_Connection object that the database connection of this mapper.
@ -58,7 +62,7 @@ abstract class Doctrine_EntityPersister_Abstract
/**
* The EntityManager.
*
* @var unknown_type
* @var Doctrine::ORM::EntityManager
*/
protected $_em;
@ -68,30 +72,100 @@ abstract class Doctrine_EntityPersister_Abstract
private $_nullObject;
/**
* Enter description here...
*
* @var unknown_type
* @todo To EntityManager.
*/
private $_dataTemplate = array();
/**
* Constructs a new mapper.
*
* @param string $name The name of the domain class this mapper is used for.
* @param Doctrine_Table $table The table object used for the mapping procedure.
* @throws Doctrine_Connection_Exception if there are no opened connections
* Constructs a new persister.
*/
public function __construct(Doctrine_EntityManager $em, Doctrine_ClassMetadata $classMetadata)
{
$this->_em = $em;
$this->_domainClassName = $classMetadata->getClassName();
$this->_conn = $classMetadata->getConnection();
$this->_entityName = $classMetadata->getClassName();
$this->_conn = $em->getConnection();
$this->_classMetadata = $classMetadata;
$this->_nullObject = Doctrine_Null::$INSTANCE;
}
public function insert(Doctrine_Entity $entity)
{
//...
}
public function update(Doctrine_Entity $entity)
{
//...
}
public function delete(Doctrine_Entity $entity)
{
}
/**
* Inserts a row into a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _insertRow($tableName, array $data)
{
$this->_conn->insert($tableName, $data);
}
/**
* Deletes rows of a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _deleteRow($tableName, array $identifierToMatch)
{
$this->_conn->delete($tableName, $identifierToMatch);
}
/**
* Deletes rows of a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _updateRow($tableName, array $data, array $identifierToMatch)
{
$this->_conn->update($tableName, $data, $identifierToMatch);
}
public function getClassMetadata()
{
return $this->_classMetadata;
}
public function getFieldNames()
{
if ($this->_fieldNames) {
return $this->_fieldNames;
}
$this->_fieldNames = $this->_classMetadata->getFieldNames();
return $this->_fieldNames;
}
public function getOwningClass($fieldName)
{
return $this->_classMetadata;
}
/**
* Callback that is invoked during the SQL construction process.
*/
public function getCustomJoins()
{
return array();
}
/**
* Callback that is invoked during the SQL construction process.
*/
public function getCustomFields()
{
return array();
}
/**
* Assumes that the keys of the given field array are field names and converts
* them to column names.
@ -108,6 +182,14 @@ abstract class Doctrine_EntityPersister_Abstract
return $converted;
}
#############################################################
# The following is old code that needs to be removed/ported
/**
* deletes all related composites
* this method is always called internally when a record is deleted
@ -129,19 +211,6 @@ abstract class Doctrine_EntityPersister_Abstract
}
}
/**
* sets the connection for this class
*
* @params Doctrine_Connection a connection object
* @return Doctrine_Table this object
* @todo refactor
*/
/*public function setConnection(Doctrine_Connection $conn)
{
$this->_conn = $conn;
return $this;
}*/
/**
* Returns the connection the mapper is currently using.
*
@ -482,7 +551,7 @@ abstract class Doctrine_EntityPersister_Abstract
* @return boolean true on success, false on failure
* @throws Doctrine_Mapper_Exception
*/
public function delete(Doctrine_Entity $record, Doctrine_Connection $conn = null)
public function delete_old(Doctrine_Entity $record)
{
if ( ! $record->exists()) {
return false;
@ -513,80 +582,5 @@ abstract class Doctrine_EntityPersister_Abstract
return true;
}
abstract protected function _doDelete(Doctrine_Entity $entity);
/**
* Inserts a row into a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _insertRow($tableName, array $data)
{
$this->_conn->insert($tableName, $data);
}
/**
* Deletes rows of a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _deleteRow($tableName, array $identifierToMatch)
{
$this->_conn->delete($tableName, $identifierToMatch);
}
/**
* Deletes rows of a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _updateRow($tableName, array $data, array $identifierToMatch)
{
$this->_conn->update($tableName, $data, $identifierToMatch);
}
public function getClassMetadata()
{
return $this->_classMetadata;
}
/*public function getFieldName($columnName)
{
return $this->_classMetadata->getFieldName($columnName);
}*/
public function getFieldNames()
{
if ($this->_fieldNames) {
return $this->_fieldNames;
}
$this->_fieldNames = $this->_classMetadata->getFieldNames();
return $this->_fieldNames;
}
public function getOwningClass($fieldName)
{
return $this->_classMetadata;
}
/* Hooks used during SQL query construction to manipulate the query. */
/**
* Callback that is invoked during the SQL construction process.
*/
public function getCustomJoins()
{
return array();
}
/**
* Callback that is invoked during the SQL construction process.
*/
public function getCustomFields()
{
return array();
}
}

View File

@ -32,6 +32,7 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @todo Rename to ExportManager. Subclasses: MySqlExportManager, PgSqlExportManager etc.
*/
class Doctrine_Export extends Doctrine_Connection_Module
{

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Export');
/**
* Doctrine_Export_Oracle
*

View File

@ -31,6 +31,7 @@
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Merge all Expression classes into the appropriate DBAL DatabasePlatform classes.
*/
class Doctrine_Expression
{

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Connection_Module');
/**
* Doctrine_Expression_Driver
*

View File

@ -31,218 +31,9 @@
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Remove
*/
class Doctrine_Formatter extends Doctrine_Connection_Module
{
/**
* Quotes pattern (% and _) characters in a string)
*
* EXPERIMENTAL
*
* WARNING: this function is experimental and may change signature at
* any time until labelled as non-experimental
*
* @param string the input string to quote
*
* @return string quoted string
*/
public function escapePattern($text)
{
return $text;
/*if ( ! $this->string_quoting['escape_pattern']) {
return $text;
}
$tmp = $this->conn->string_quoting;
$text = str_replace($tmp['escape_pattern'],
$tmp['escape_pattern'] .
$tmp['escape_pattern'], $text);
foreach ($this->wildcards as $wildcard) {
$text = str_replace($wildcard, $tmp['escape_pattern'] . $wildcard, $text);
}
return $text;*/
}
/**
* convertBooleans
* some drivers need the boolean values to be converted into integers
* when using DQL API
*
* This method takes care of that conversion
*
* @param array $item
* @return void
*/
public function convertBooleans($item)
{
if (is_array($item)) {
foreach ($item as $k => $value) {
if (is_bool($value)) {
$item[$k] = (int) $value;
}
}
} else {
if (is_bool($item)) {
$item = (int) $item;
}
}
return $item;
}
/**
* Quote a string so it can be safely used as a table or column name
*
* Delimiting style depends on which database driver is being used.
*
* NOTE: just because you CAN use delimited identifiers doesn't mean
* you SHOULD use them. In general, they end up causing way more
* problems than they solve.
*
* Portability is broken by using the following characters inside
* delimited identifiers:
* + backtick (<kbd>`</kbd>) -- due to MySQL
* + double quote (<kbd>"</kbd>) -- due to Oracle
* + brackets (<kbd>[</kbd> or <kbd>]</kbd>) -- due to Access
*
* Delimited identifiers are known to generally work correctly under
* the following drivers:
* + mssql
* + mysql
* + mysqli
* + oci8
* + pgsql
* + sqlite
*
* InterBase doesn't seem to be able to use delimited identifiers
* via PHP 4. They work fine under PHP 5.
*
* @param string $str identifier name to be quoted
* @param bool $checkOption check the 'quote_identifier' option
*
* @return string quoted identifier string
*/
public function quoteIdentifier($str, $checkOption = true)
{
if ($checkOption && ! $this->conn->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER)) {
return $str;
}
$tmp = $this->conn->identifier_quoting;
$str = str_replace($tmp['end'],
$tmp['escape'] .
$tmp['end'], $str);
return $tmp['start'] . $str . $tmp['end'];
}
/**
* quote
* quotes given input parameter
*
* @param mixed $input parameter to be quoted
* @param string $type
* @return mixed
*/
public function quote($input, $type = null)
{
if ($type == null) {
$type = gettype($input);
}
switch ($type) {
case 'integer':
case 'enum':
case 'boolean':
case 'double':
case 'float':
case 'bool':
case 'decimal':
case 'int':
return $input;
case 'array':
case 'object':
$input = serialize($input);
case 'date':
case 'time':
case 'timestamp':
case 'string':
case 'char':
case 'varchar':
case 'text':
case 'gzip':
case 'blob':
case 'clob':
return $this->conn->quote($input);
}
}
/**
* Removes any formatting in an sequence name using the 'seqname_format' option
*
* @param string $sqn string that containts name of a potential sequence
* @return string name of the sequence with possible formatting removed
*/
public function fixSequenceName($sqn)
{
$seqPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT)).'$/i';
$seqName = preg_replace($seqPattern, '\\1', $sqn);
if ($seqName && ! strcasecmp($sqn, $this->getSequenceName($seqName))) {
return $seqName;
}
return $sqn;
}
/**
* Removes any formatting in an index name using the 'idxname_format' option
*
* @param string $idx string that containts name of anl index
* @return string name of the index with possible formatting removed
*/
public function fixIndexName($idx)
{
$indexPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT)).'$/i';
$indexName = preg_replace($indexPattern, '\\1', $idx);
if ($indexName && ! strcasecmp($idx, $this->getIndexName($indexName))) {
return $indexName;
}
return $idx;
}
/**
* adds sequence name formatting to a sequence name
*
* @param string name of the sequence
* @return string formatted sequence name
*/
public function getSequenceName($sqn)
{
return sprintf($this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT),
preg_replace('/[^a-z0-9_\$.]/i', '_', $sqn));
}
/**
* adds index name formatting to a index name
*
* @param string name of the index
* @return string formatted index name
*/
public function getIndexName($idx)
{
return sprintf($this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT),
preg_replace('/[^a-z0-9_\$]/i', '_', $idx));
}
/**
* adds table name formatting to a table name
*
* @param string name of the table
* @return string formatted table name
*/
public function getTableName($table)
{
return $table;
/*
return sprintf($this->conn->getAttribute(Doctrine::ATTR_TBLNAME_FORMAT),
$table);*/
}
}

View File

@ -20,15 +20,14 @@
*/
/**
* Doctrine_Hydrator_Abstract
* Base class for all hydrators (ok, we got only 1 currently).
*
* @package Doctrine
* @subpackage Hydrate
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3192 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
abstract class Doctrine_Hydrator_Abstract
{
@ -71,7 +70,6 @@ abstract class Doctrine_Hydrator_Abstract
$this->_nullObject = Doctrine_Null::$INSTANCE;
}
/**
* setHydrationMode
*
@ -85,7 +83,6 @@ abstract class Doctrine_Hydrator_Abstract
$this->_hydrationMode = $hydrationMode;
}
/**
* setQueryComponents
*
@ -98,7 +95,6 @@ abstract class Doctrine_Hydrator_Abstract
$this->_queryComponents = $queryComponents;
}
/**
* getQueryComponents
*
@ -111,7 +107,6 @@ abstract class Doctrine_Hydrator_Abstract
return $this->_queryComponents;
}
/**
* setTableAliasMap
*
@ -124,7 +119,6 @@ abstract class Doctrine_Hydrator_Abstract
$this->_tableAliasMap = $tableAliasMap;
}
/**
* getTableAliasMap
*
@ -137,7 +131,6 @@ abstract class Doctrine_Hydrator_Abstract
return $this->_tableAliasMap;
}
/**
* hydrateResultSet
*

View File

@ -20,16 +20,14 @@
*/
/**
* Doctrine_Hydrator_ArrayDriver
* Defines an array fetching strategy.
* Defines an array hydration strategy.
*
* @package Doctrine
* @subpackage Hydrate
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
class Doctrine_Hydrator_ArrayDriver
{
@ -50,14 +48,6 @@ class Doctrine_Hydrator_ArrayDriver
return $data;
}
/**
*
*/
/*public function isIdentifiable(array $data, Doctrine_Table $table)
{
return ( ! empty($data));
}*/
/**
*
*/

View File

@ -20,17 +20,15 @@
*/
/**
* Doctrine_Hydrator_RecordDriver
* Hydration strategy used for creating graphs of entity objects.
* Hydration strategy used for creating graphs of entities.
*
* @package Doctrine
* @subpackage Hydrate
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @todo Rename to ObjectDriver
*/
class Doctrine_Hydrator_RecordDriver
{

View File

@ -171,9 +171,6 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
$rowData = $this->_gatherRowData($data, $cache, $id, $nonemptyComponents);
// 2) Hydrate the data of the root entity from the current row
//$class = $this->_queryComponents[$rootAlias]['metadata'];
//$entityName = $class->getComponentName();
// Check for an existing element
$index = false;
if ($isSimpleQuery || ! isset($identifierMap[$rootAlias][$id[$rootAlias]])) {
@ -208,7 +205,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
}
// 3) Now hydrate the rest of the data found in the current row, that
// belongs to other (related) Entities.
// belongs to other (related) entities.
foreach ($rowData as $dqlAlias => $data) {
$index = false;
$map = $this->_queryComponents[$dqlAlias];
@ -295,7 +292,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
/**
* Updates the result pointer for an Entity. The result pointers point to the
* last seen instance of each Entity. This is used for graph construction.
* last seen instance of each Entity type. This is used for graph construction.
*
* @param array $resultPointers The result pointers.
* @param array|Collection $coll The element.
@ -541,12 +538,6 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
case 'boolean':
// don't do any conversions on primitive types
break;
//case 'enum':
// return $class->enumValue($fieldName, $value);
//break;
//case 'boolean':
// return (boolean) $value;
//break;
case 'array':
case 'object':
if (is_string($value)) {

View File

@ -1,4 +1,23 @@
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal;

View File

@ -1,9 +1,26 @@
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal;
#use Doctrine::ORM::Mapping::ClassMetadata;
/**
* A CommitOrderNode is a temporary wrapper around ClassMetadata objects
* that is used to sort the order of commits.
@ -123,7 +140,7 @@ class Doctrine_Internal_CommitOrderNode
}
/**
* Adds a directed dependency (an edge). "$this -before-> $other".
* Adds a directed dependency (an edge on the graph). "$this -before-> $other".
*
* @param Doctrine_Internal_CommitOrderNode $node
*/

View File

@ -20,7 +20,6 @@
*/
/**
* Doctrine_Sequence
* The base class for sequence handling drivers.
*
* @package Doctrine

View File

@ -19,6 +19,8 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::DBAL::Sequences;
/**
* Doctrine_Sequence_Mysql
*

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Transaction');
/**
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>

View File

@ -32,7 +32,7 @@ class Orm_UnitOfWorkTest extends Doctrine_OrmTestCase
$this->_user->username = 'romanb';
$this->_connectionMock = new Doctrine_ConnectionMock(array());
$this->_sequenceMock = $this->_connectionMock->getSequenceModule();
$this->_sequenceMock = $this->_connectionMock->getSequenceManager();
$this->_emMock = new Doctrine_EntityManagerMock($this->_connectionMock);
$this->_persisterMock = $this->_emMock->getEntityPersister("ForumUser");
$this->_unitOfWork = $this->_emMock->getUnitOfWork();

View File

@ -7,7 +7,7 @@ class Doctrine_ConnectionMock extends Doctrine_Connection
protected $_driverName = 'Mysql';
private $_sequenceModuleMock;
public function getSequenceModule()
public function getSequenceManager()
{
if ( ! $this->_sequenceModuleMock) {
$this->_sequenceModuleMock = new Doctrine_SequenceMock($this);

View File

@ -18,7 +18,7 @@ class CmsArticle extends Doctrine_Entity
'type' => 'integer',
'length' => 4,
'id' => true,
'generatorType' => 'auto'
'idGenerator' => 'auto'
));
$mapping->mapField(array(
'fieldName' => 'topic',

View File

@ -18,7 +18,7 @@ class CmsUser extends Doctrine_Entity
'type' => 'integer',
'length' => 4,
'id' => true,
'generatorType' => 'auto'
'idGenerator' => 'auto'
));
$mapping->mapField(array(
'fieldName' => 'status',

View File

@ -16,7 +16,7 @@ class ForumEntry extends Doctrine_Entity
'type' => 'integer',
'length' => 4,
'id' => true,
'generatorType' => 'auto'
'idGenerator' => 'auto'
));
$mapping->mapField(array(
'fieldName' => 'topic',

View File

@ -34,7 +34,7 @@ class ForumUser extends Doctrine_Entity
'type' => 'integer',
'length' => 4,
'id' => true,
'generatorType' => 'auto'
'idGenerator' => 'auto'
));
$mapping->mapField(array(
'fieldName' => 'username',