Commit d76814c8 authored by zYne's avatar zYne

removed Doctrine_Identifier

parent 4add4697
...@@ -411,7 +411,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module ...@@ -411,7 +411,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$this->conn->insert($table->getTableName(), $array); $this->conn->insert($table->getTableName(), $array);
if (empty($seq) && count($keys) == 1 && $keys[0] == $table->getIdentifier() && if (empty($seq) && count($keys) == 1 && $keys[0] == $table->getIdentifier() &&
$table->getIdentifierType() != Doctrine_Identifier::NORMAL) { $table->getIdentifierType() != Doctrine::IDENTIFIER_NATURAL) {
if (strtolower($this->conn->getName()) == 'pgsql') { if (strtolower($this->conn->getName()) == 'pgsql') {
$seq = $table->getTableName() . '_' . $keys[0]; $seq = $table->getTableName() . '_' . $keys[0];
......
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*/
/**
* Doctrine_Identifier
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_Identifier
{
/**
* constant for auto_increment identifier
*/
const AUTO_INCREMENT = 1;
/**
* constant for sequence identifier
*/
const SEQUENCE = 2;
/**
* constant for normal identifier
*/
const NORMAL = 3;
/**
* constant for composite identifier
*/
const COMPOSITE = 4;
}
...@@ -429,8 +429,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -429,8 +429,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
private function prepareIdentifiers($exists = true) private function prepareIdentifiers($exists = true)
{ {
switch ($this->_table->getIdentifierType()) { switch ($this->_table->getIdentifierType()) {
case Doctrine_Identifier::AUTO_INCREMENT: case Doctrine::IDENTIFIER_AUTOINC:
case Doctrine_Identifier::SEQUENCE: case Doctrine::IDENTIFIER_SEQUENCE:
$name = $this->_table->getIdentifier(); $name = $this->_table->getIdentifier();
if ($exists) { if ($exists) {
...@@ -442,7 +442,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -442,7 +442,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
unset($this->_data[$name]); unset($this->_data[$name]);
break; break;
case Doctrine_Identifier::NORMAL: case Doctrine::IDENTIFIER_NATURAL:
$this->_id = array(); $this->_id = array();
$name = $this->_table->getIdentifier(); $name = $this->_table->getIdentifier();
...@@ -450,7 +450,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -450,7 +450,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$this->_id[$name] = $this->_data[$name]; $this->_id[$name] = $this->_data[$name];
} }
break; break;
case Doctrine_Identifier::COMPOSITE: case Doctrine::IDENTIFIER_COMPOSITE:
$names = $this->_table->getIdentifier(); $names = $this->_table->getIdentifier();
foreach ($names as $name) { foreach ($names as $name) {
......
...@@ -241,13 +241,13 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -241,13 +241,13 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
$this->primaryKeys[] = 'id'; $this->primaryKeys[] = 'id';
$this->identifier = 'id'; $this->identifier = 'id';
$this->identifierType = Doctrine_Identifier::AUTO_INCREMENT; $this->identifierType = Doctrine::IDENTIFIER_AUTOINC;
$this->columnCount++; $this->columnCount++;
break; break;
default: default:
if (count($this->primaryKeys) > 1) { if (count($this->primaryKeys) > 1) {
$this->identifier = $this->primaryKeys; $this->identifier = $this->primaryKeys;
$this->identifierType = Doctrine_Identifier::COMPOSITE; $this->identifierType = Doctrine::IDENTIFIER_COMPOSITE;
} else { } else {
foreach ($this->primaryKeys as $pk) { foreach ($this->primaryKeys as $pk) {
...@@ -264,12 +264,12 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -264,12 +264,12 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
switch (strtolower($e2[0])) { switch (strtolower($e2[0])) {
case 'autoincrement': case 'autoincrement':
case 'autoinc': case 'autoinc':
$this->identifierType = Doctrine_Identifier::AUTO_INCREMENT; $this->identifierType = Doctrine::IDENTIFIER_AUTOINC;
$found = true; $found = true;
break; break;
case 'seq': case 'seq':
case 'sequence': case 'sequence':
$this->identifierType = Doctrine_Identifier::SEQUENCE; $this->identifierType = Doctrine::IDENTIFIER_SEQUENCE;
$found = true; $found = true;
if ($value) { if ($value) {
...@@ -285,7 +285,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -285,7 +285,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
} }
} }
if ( ! isset($this->identifierType)) { if ( ! isset($this->identifierType)) {
$this->identifierType = Doctrine_Identifier::NORMAL; $this->identifierType = Doctrine::IDENTIFIER_NATURAL;
} }
$this->identifier = $pk; $this->identifier = $pk;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment