Core changes: getID() now returns array for better composite primary key support
This commit is contained in:
parent
267bdfa2e8
commit
bb1a39683c
@ -234,7 +234,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
|
|
||||||
if(isset($this->relation)) {
|
if(isset($this->relation)) {
|
||||||
if($this->relation instanceof Doctrine_ForeignKey) {
|
if($this->relation instanceof Doctrine_ForeignKey) {
|
||||||
$params = array($this->reference->getID());
|
$params[] = $this->reference->getIncremented();
|
||||||
$where[] = $this->reference_field." = ?";
|
$where[] = $this->reference_field." = ?";
|
||||||
|
|
||||||
if( ! isset($offset)) {
|
if( ! isset($offset)) {
|
||||||
@ -252,7 +252,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
} elseif($this->relation instanceof Doctrine_Association) {
|
} elseif($this->relation instanceof Doctrine_Association) {
|
||||||
|
|
||||||
$asf = $this->relation->getAssociationFactory();
|
$asf = $this->relation->getAssociationFactory();
|
||||||
$query = "SELECT ".$foreign." FROM ".$asf->getTableName()." WHERE ".$local."=".$this->getID();
|
$query = "SELECT ".$foreign." FROM ".$asf->getTableName()." WHERE ".$local."=".$this->getIncremented();
|
||||||
|
|
||||||
$table = $fk->getTable();
|
$table = $fk->getTable();
|
||||||
$graph = new Doctrine_DQL_Parser($table->getSession());
|
$graph = new Doctrine_DQL_Parser($table->getSession());
|
||||||
@ -344,6 +344,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
if($value !== null) {
|
if($value !== null) {
|
||||||
$this->data[$key]->rawSet($this->reference_field, $value);
|
$this->data[$key]->rawSet($this->reference_field, $value);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->data[$key]->rawSet($this->reference_field, $this->reference);
|
$this->data[$key]->rawSet($this->reference_field, $this->reference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,7 +364,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
if(is_array($record) && isset($record[$name])) {
|
if(is_array($record) && isset($record[$name])) {
|
||||||
$list[] = $record[$name];
|
$list[] = $record[$name];
|
||||||
} else {
|
} else {
|
||||||
$list[] = $record->getID();
|
$list[] = $record->getIncremented();
|
||||||
}
|
}
|
||||||
endforeach;
|
endforeach;
|
||||||
return $list;
|
return $list;
|
||||||
@ -407,6 +408,10 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
if(isset($this->reference_field))
|
if(isset($this->reference_field))
|
||||||
$record->rawSet($this->reference_field,$this->reference);
|
$record->rawSet($this->reference_field,$this->reference);
|
||||||
|
|
||||||
|
if(in_array($record,$this->data)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($key)) {
|
if(isset($key)) {
|
||||||
if(isset($this->data[$key]))
|
if(isset($this->data[$key]))
|
||||||
return false;
|
return false;
|
||||||
@ -414,10 +419,6 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
$this->data[$key] = $record;
|
$this->data[$key] = $record;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(in_array($record,$this->data)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($this->generator)) {
|
if(isset($this->generator)) {
|
||||||
$key = $this->generator->getIndex($record);
|
$key = $this->generator->getIndex($record);
|
||||||
|
@ -81,7 +81,7 @@ class Doctrine_Collection_Batch extends Doctrine_Collection {
|
|||||||
|
|
||||||
for($i = $e; $i < $e2 && $i < $this->count(); $i++):
|
for($i = $e; $i < $e2 && $i < $this->count(); $i++):
|
||||||
if($this->data[$i] instanceof Doctrine_Record)
|
if($this->data[$i] instanceof Doctrine_Record)
|
||||||
$id = $this->data[$i]->getID();
|
$id = $this->data[$i]->getIncremented();
|
||||||
elseif(is_array($this->data[$i]))
|
elseif(is_array($this->data[$i]))
|
||||||
$id = $this->data[$i][$identifier];
|
$id = $this->data[$i][$identifier];
|
||||||
|
|
||||||
|
@ -129,12 +129,17 @@ class Doctrine_DBStatement extends PDOStatement {
|
|||||||
/**
|
/**
|
||||||
* @param array $params
|
* @param array $params
|
||||||
*/
|
*/
|
||||||
public function execute(array $params = null) {
|
public function execute(array $params = array()) {
|
||||||
$time = microtime();
|
|
||||||
$result = parent::execute($params);
|
|
||||||
|
|
||||||
|
$time = microtime();
|
||||||
|
try {
|
||||||
|
$result = parent::execute($params);
|
||||||
|
} catch(PDOException $e) {
|
||||||
|
throw new Doctrine_Exception($this->queryString." ".$e->__toString());
|
||||||
|
}
|
||||||
$exectime = (microtime() - $time);
|
$exectime = (microtime() - $time);
|
||||||
$this->dbh->addExecTime($exectime);
|
$this->dbh->addExecTime($exectime);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,9 @@ class Doctrine_DataDict {
|
|||||||
|
|
||||||
$return = true;
|
$return = true;
|
||||||
foreach($a as $sql) {
|
foreach($a as $sql) {
|
||||||
try {
|
try {
|
||||||
$this->dbh->query($sql);
|
$this->dbh->query($sql);
|
||||||
} catch(PDOException $e) {
|
} catch(Exception $e) {
|
||||||
|
|
||||||
$return = $e;
|
$return = $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +70,7 @@ class Doctrine_DataDict {
|
|||||||
case "mbstring":
|
case "mbstring":
|
||||||
if($length <= 255)
|
if($length <= 255)
|
||||||
return "C2($length)";
|
return "C2($length)";
|
||||||
|
|
||||||
return "X2";
|
return "X2";
|
||||||
case "clob":
|
case "clob":
|
||||||
return "XL";
|
return "XL";
|
||||||
|
@ -86,7 +86,9 @@ class Doctrine_Locking_Manager_Pessimistic
|
|||||||
try {
|
try {
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$gotLock = true;
|
$gotLock = true;
|
||||||
} catch(PDOException $pkviolation) {
|
|
||||||
|
// we catch an Exception here instead of PDOException since we might also be catching Doctrine_Exception
|
||||||
|
} catch(Exception $pkviolation) {
|
||||||
// PK violation occured => existing lock!
|
// PK violation occured => existing lock!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,9 +114,9 @@ class Doctrine_Locking_Manager_Pessimistic
|
|||||||
$dbh->commit();
|
$dbh->commit();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(PDOException $pdoe)
|
catch(Exception $pdoe)
|
||||||
{
|
{
|
||||||
$dbh->rollBack();
|
$dbh->rollback();
|
||||||
throw new Doctrine_Locking_Exception($pdoe->getMessage());
|
throw new Doctrine_Locking_Exception($pdoe->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ class Doctrine_Query extends Doctrine_Access {
|
|||||||
|
|
||||||
// one-to-one relation
|
// one-to-one relation
|
||||||
|
|
||||||
$last->internalSet($fk->getLocal(), $record->getID());
|
$last->internalSet($fk->getLocal(), $record->getIncremented());
|
||||||
|
|
||||||
$last->initSingleReference($record, $fk);
|
$last->initSingleReference($record, $fk);
|
||||||
|
|
||||||
|
@ -65,9 +65,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
*/
|
*/
|
||||||
protected $table;
|
protected $table;
|
||||||
/**
|
/**
|
||||||
* @var integer $id the primary key of this object
|
* @var integer $id the primary keys of this object
|
||||||
*/
|
*/
|
||||||
protected $id;
|
protected $id = array();
|
||||||
/**
|
/**
|
||||||
* @var array $data the record data
|
* @var array $data the record data
|
||||||
*/
|
*/
|
||||||
@ -266,7 +266,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
|
|
||||||
if($exists) {
|
if($exists) {
|
||||||
if(isset($this->data[$name]) && $this->data[$name] !== self::$null)
|
if(isset($this->data[$name]) && $this->data[$name] !== self::$null)
|
||||||
$this->id = $this->data[$name];
|
$this->id[$name] = $this->data[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->data[$name]);
|
unset($this->data[$name]);
|
||||||
@ -300,10 +300,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
unset($vars['originals']);
|
unset($vars['originals']);
|
||||||
unset($vars['table']);
|
unset($vars['table']);
|
||||||
|
|
||||||
if( ! is_array($this->id)) {
|
|
||||||
$name = $this->table->getIdentifier();
|
$name = $this->table->getIdentifier();
|
||||||
$this->data = array_merge($this->data, array($name => $this->id));
|
$this->data = array_merge($this->data, $this->id);
|
||||||
}
|
|
||||||
|
|
||||||
foreach($this->data as $k => $v) {
|
foreach($this->data as $k => $v) {
|
||||||
if($v instanceof Doctrine_Record)
|
if($v instanceof Doctrine_Record)
|
||||||
@ -441,17 +440,17 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
*/
|
*/
|
||||||
final public function factoryRefresh() {
|
final public function factoryRefresh() {
|
||||||
$data = $this->table->getData();
|
$data = $this->table->getData();
|
||||||
$id = $this->id;
|
$old = $this->id;
|
||||||
|
|
||||||
|
$this->cleanData();
|
||||||
|
|
||||||
$this->prepareIdentifiers();
|
$this->prepareIdentifiers();
|
||||||
|
|
||||||
if($this->id != $id)
|
if($this->id != $old)
|
||||||
throw new Doctrine_Record_Exception();
|
throw new Doctrine_Record_Exception();
|
||||||
|
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
|
|
||||||
$this->cleanData();
|
|
||||||
|
|
||||||
$this->state = Doctrine_Record::STATE_CLEAN;
|
$this->state = Doctrine_Record::STATE_CLEAN;
|
||||||
$this->modified = array();
|
$this->modified = array();
|
||||||
|
|
||||||
@ -521,8 +520,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
return $this->data[$name];
|
return $this->data[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($this->id[$name]))
|
||||||
|
return $this->id[$name];
|
||||||
|
|
||||||
if($name === $this->table->getIdentifier())
|
if($name === $this->table->getIdentifier())
|
||||||
return $this->id;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
if( ! isset($this->references[$name]))
|
if( ! isset($this->references[$name]))
|
||||||
@ -549,9 +551,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
*/
|
*/
|
||||||
final public function rawSet($name,$value) {
|
final public function rawSet($name,$value) {
|
||||||
if($value instanceof Doctrine_Record)
|
if($value instanceof Doctrine_Record)
|
||||||
$id = $value->getID();
|
$id = $value->getIncremented();
|
||||||
|
|
||||||
if( ! empty($id))
|
if(isset($id))
|
||||||
$value = $id;
|
$value = $id;
|
||||||
|
|
||||||
if(isset($this->data[$name])) {
|
if(isset($this->data[$name])) {
|
||||||
@ -585,13 +587,16 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function set($name,$value) {
|
public function set($name,$value) {
|
||||||
|
if(is_array($value))
|
||||||
|
throw new Exception($value);
|
||||||
|
|
||||||
if(isset($this->data[$name])) {
|
if(isset($this->data[$name])) {
|
||||||
|
|
||||||
if($value instanceof Doctrine_Record) {
|
if($value instanceof Doctrine_Record) {
|
||||||
$id = $value->getID();
|
$id = $value->getIncremented();
|
||||||
|
|
||||||
if( ! empty($id))
|
if($id !== null)
|
||||||
$value = $value->getID();
|
$value = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$old = $this->get($name);
|
$old = $this->get($name);
|
||||||
@ -747,9 +752,10 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->data[$v] instanceof Doctrine_Record)
|
if($this->data[$v] instanceof Doctrine_Record) {
|
||||||
$this->data[$v] = $this->data[$v]->getID();
|
$this->data[$v] = $this->data[$v]->getIncremented();
|
||||||
|
}
|
||||||
|
|
||||||
$a[$v] = $this->data[$v];
|
$a[$v] = $this->data[$v];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -811,13 +817,14 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
foreach($r["delete"] as $record) {
|
foreach($r["delete"] as $record) {
|
||||||
$query = "DELETE FROM ".$asf->getTableName()." WHERE ".$fk->getForeign()." = ?"
|
$query = "DELETE FROM ".$asf->getTableName()." WHERE ".$fk->getForeign()." = ?"
|
||||||
." AND ".$fk->getLocal()." = ?";
|
." AND ".$fk->getLocal()." = ?";
|
||||||
$this->table->getSession()->execute($query, array($record->getID(),$this->getID()));
|
$this->table->getSession()->execute($query, array($record->getIncremented(),$this->getIncremented()));
|
||||||
}
|
}
|
||||||
foreach($r["add"] as $record) {
|
foreach($r["add"] as $record) {
|
||||||
$reldao = $asf->create();
|
$reldao = $asf->create();
|
||||||
$reldao->set($fk->getForeign(),$record);
|
$reldao->set($fk->getForeign(),$record);
|
||||||
$reldao->set($fk->getLocal(),$this);
|
$reldao->set($fk->getLocal(),$this);
|
||||||
$reldao->save();
|
$reldao->save();
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->originals[$alias] = clone $this->references[$alias];
|
$this->originals[$alias] = clone $this->references[$alias];
|
||||||
}
|
}
|
||||||
@ -825,7 +832,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
endswitch;
|
endswitch;
|
||||||
} elseif($fk instanceof Doctrine_ForeignKey ||
|
} elseif($fk instanceof Doctrine_ForeignKey ||
|
||||||
$fk instanceof Doctrine_LocalKey) {
|
$fk instanceof Doctrine_LocalKey) {
|
||||||
|
|
||||||
switch($fk->getType()):
|
switch($fk->getType()):
|
||||||
case Doctrine_Relation::ONE_COMPOSITE:
|
case Doctrine_Relation::ONE_COMPOSITE:
|
||||||
if(isset($this->originals[$alias]) && $this->originals[$alias]->getID() != $this->references[$alias]->getID())
|
if(isset($this->originals[$alias]) && $this->originals[$alias]->getID() != $this->references[$alias]->getID())
|
||||||
@ -877,9 +884,10 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
|
|
||||||
if($record->getID() !== null) {
|
$id = $record->getIncremented();
|
||||||
|
if( ! empty($id)) {
|
||||||
foreach($this->originals[$name] as $k2 => $record2) {
|
foreach($this->originals[$name] as $k2 => $record2) {
|
||||||
if($record2->getID() == $record->getID()) {
|
if($record2->getIncremented() === $record->getIncremented()) {
|
||||||
$found = true;
|
$found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -892,12 +900,14 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->originals[$name] as $k => $record) {
|
foreach($this->originals[$name] as $k => $record) {
|
||||||
if($record->getID() === null)
|
$id = $record->getIncremented();
|
||||||
|
|
||||||
|
if(empty($id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach($new as $k2=>$record2) {
|
foreach($new as $k2 => $record2) {
|
||||||
if($record2->getID() == $record->getID()) {
|
if($record2->getIncremented() === $record->getIncremented()) {
|
||||||
$found = true;
|
$found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -944,7 +954,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
*/
|
*/
|
||||||
final public function setID($id = false) {
|
final public function setID($id = false) {
|
||||||
if($id === false) {
|
if($id === false) {
|
||||||
$this->id = false;
|
$this->id = array();
|
||||||
$this->cleanData();
|
$this->cleanData();
|
||||||
$this->state = Doctrine_Record::STATE_TCLEAN;
|
$this->state = Doctrine_Record::STATE_TCLEAN;
|
||||||
$this->modified = array();
|
$this->modified = array();
|
||||||
@ -954,18 +964,32 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
$this->modified = array();
|
$this->modified = array();
|
||||||
} else {
|
} else {
|
||||||
$name = $this->table->getIdentifier();
|
$name = $this->table->getIdentifier();
|
||||||
$this->id = $id;
|
|
||||||
|
$this->id[$name] = $id;
|
||||||
$this->state = Doctrine_Record::STATE_CLEAN;
|
$this->state = Doctrine_Record::STATE_CLEAN;
|
||||||
$this->modified = array();
|
$this->modified = array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* return the primary key(s) this object is pointing at
|
* returns the primary keys of this object
|
||||||
* @return mixed id
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
final public function getID() {
|
final public function getID() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* returns the value of autoincremented primary key of this object (if any)
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
final public function getIncremented() {
|
||||||
|
$id = current($this->id);
|
||||||
|
if($id === false)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* getLast
|
* getLast
|
||||||
* this method is used internally be Doctrine_Query
|
* this method is used internally be Doctrine_Query
|
||||||
@ -1134,7 +1158,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
$graph = new Doctrine_Query($table->getSession());
|
$graph = new Doctrine_Query($table->getSession());
|
||||||
$query = "FROM ".$table->getComponentName()." WHERE ".$table->getComponentName().".".$table->getIdentifier()." IN ($query)";
|
$query = "FROM ".$table->getComponentName()." WHERE ".$table->getComponentName().".".$table->getIdentifier()." IN ($query)";
|
||||||
|
|
||||||
$coll = $graph->query($query, array($this->getID()));
|
$coll = $graph->query($query, array($this->getIncremented()));
|
||||||
|
|
||||||
$this->references[$name] = $coll;
|
$this->references[$name] = $coll;
|
||||||
$this->originals[$name] = clone $coll;
|
$this->originals[$name] = clone $coll;
|
||||||
|
@ -446,7 +446,7 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
|
|||||||
$this->transaction_level--;
|
$this->transaction_level--;
|
||||||
|
|
||||||
if($this->transaction_level == 0) {
|
if($this->transaction_level == 0) {
|
||||||
|
|
||||||
|
|
||||||
if($this->getAttribute(Doctrine::ATTR_LOCKMODE) == Doctrine::LOCK_OPTIMISTIC) {
|
if($this->getAttribute(Doctrine::ATTR_LOCKMODE) == Doctrine::LOCK_OPTIMISTIC) {
|
||||||
$this->getAttribute(Doctrine::ATTR_LISTENER)->onPreTransactionBegin($this);
|
$this->getAttribute(Doctrine::ATTR_LISTENER)->onPreTransactionBegin($this);
|
||||||
@ -477,7 +477,7 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
|
|||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
$this->rollback();
|
$this->rollback();
|
||||||
|
|
||||||
throw new Doctrine_Exception($e->getMessage());
|
throw new Doctrine_Exception($e->__toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getAttribute(Doctrine::ATTR_LISTENER)->onTransactionCommit($this);
|
$this->getAttribute(Doctrine::ATTR_LISTENER)->onTransactionCommit($this);
|
||||||
@ -534,9 +534,9 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach($inserts as $k => $record) {
|
foreach($inserts as $k => $record) {
|
||||||
$record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onPreSave($record);
|
$table->getAttribute(Doctrine::ATTR_LISTENER)->onPreSave($record);
|
||||||
// listen the onPreInsert event
|
// listen the onPreInsert event
|
||||||
$record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onPreInsert($record);
|
$table->getAttribute(Doctrine::ATTR_LISTENER)->onPreInsert($record);
|
||||||
|
|
||||||
|
|
||||||
$this->insert($record);
|
$this->insert($record);
|
||||||
@ -556,9 +556,9 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
|
|||||||
$record->setID(true);
|
$record->setID(true);
|
||||||
|
|
||||||
// listen the onInsert event
|
// listen the onInsert event
|
||||||
$record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onInsert($record);
|
$table->getAttribute(Doctrine::ATTR_LISTENER)->onInsert($record);
|
||||||
|
|
||||||
$record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onSave($record);
|
$table->getAttribute(Doctrine::ATTR_LISTENER)->onSave($record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->insert = array();
|
$this->insert = array();
|
||||||
@ -610,11 +610,7 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
|
|||||||
$record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onUpdate($record);
|
$record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onUpdate($record);
|
||||||
|
|
||||||
$record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onSave($record);
|
$record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onSave($record);
|
||||||
|
|
||||||
$ids[] = $record->getID();
|
|
||||||
}
|
}
|
||||||
if(isset($record))
|
|
||||||
$record->getTable()->getCache()->deleteMultiple($ids);
|
|
||||||
}
|
}
|
||||||
$this->update = array();
|
$this->update = array();
|
||||||
}
|
}
|
||||||
@ -629,7 +625,7 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
|
|||||||
$record = false;
|
$record = false;
|
||||||
$ids = array();
|
$ids = array();
|
||||||
foreach($deletes as $k => $record) {
|
foreach($deletes as $k => $record) {
|
||||||
$ids[] = $record->getID();
|
$ids[] = $record->getIncremented();
|
||||||
$record->setID(false);
|
$record->setID(false);
|
||||||
}
|
}
|
||||||
if($record instanceof Doctrine_Record) {
|
if($record instanceof Doctrine_Record) {
|
||||||
@ -745,7 +741,6 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
|
|||||||
*/
|
*/
|
||||||
private function update(Doctrine_Record $record) {
|
private function update(Doctrine_Record $record) {
|
||||||
$array = $record->getPrepared();
|
$array = $record->getPrepared();
|
||||||
|
|
||||||
|
|
||||||
if(empty($array))
|
if(empty($array))
|
||||||
return false;
|
return false;
|
||||||
@ -760,8 +755,8 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
|
|||||||
case Doctrine_Record::STATE_TDIRTY:
|
case Doctrine_Record::STATE_TDIRTY:
|
||||||
$record->save();
|
$record->save();
|
||||||
default:
|
default:
|
||||||
$array[$name] = $value->getID();
|
$array[$name] = $value->getIncremented();
|
||||||
$record->set($name, $value->getID());
|
$record->set($name, $value->getIncremented());
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
endforeach;
|
endforeach;
|
||||||
|
@ -34,6 +34,46 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
|
|||||||
$this->assertEqual($users->count(), 8);
|
$this->assertEqual($users->count(), 8);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
public function testMultipleFetching() {
|
||||||
|
$count = $this->dbh->count();
|
||||||
|
$this->session->getTable('User')->clear();
|
||||||
|
$this->session->getTable('Email')->clear();
|
||||||
|
$this->session->getTable('Phonenumber')->clear();
|
||||||
|
|
||||||
|
$users = $this->query->from("User-l.Phonenumber-i, User-l:Email-i")->execute();
|
||||||
|
$this->assertEqual(($count + 1),$this->dbh->count());
|
||||||
|
$this->assertEqual(count($users), 8);
|
||||||
|
|
||||||
|
$this->assertEqual($users[0]->Phonenumber->count(), 1);
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
$this->assertEqual($users[0]->Phonenumber[0]->phonenumber, "123 123");
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
|
||||||
|
$this->assertEqual($users[1]->Phonenumber->count(), 3);
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
$this->assertEqual($users[1]->Phonenumber[0]->phonenumber, "123 123");
|
||||||
|
$this->assertEqual($users[1]->Phonenumber[1]->phonenumber, "456 456");
|
||||||
|
$this->assertEqual($users[1]->Phonenumber[2]->phonenumber, "789 789");
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
|
||||||
|
$this->assertEqual($users[7]->Phonenumber->count(), 1);
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
$this->assertEqual($users[7]->Phonenumber[0]->phonenumber, "111 567 333");
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
|
||||||
|
$this->assertTrue($users[0]->Email instanceof Email);
|
||||||
|
$this->assertEqual($users[0]->Email->address, "zYne@example.com");
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
$this->assertEqual($users[0]->email_id, $users[0]->Email->id);
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
|
||||||
|
$this->assertTrue($users[1]->Email instanceof Email);
|
||||||
|
$this->assertEqual($users[1]->Email->address, "arnold@example.com");
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
$this->assertEqual($users[1]->email_id, $users[1]->Email->id);
|
||||||
|
$this->assertEqual(($count + 1), $this->dbh->count());
|
||||||
|
}
|
||||||
|
|
||||||
public function testConditionParser() {
|
public function testConditionParser() {
|
||||||
$query = new Doctrine_Query($this->session);
|
$query = new Doctrine_Query($this->session);
|
||||||
|
|
||||||
@ -698,45 +738,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
|
|||||||
$this->assertEqual($count, count($this->dbh));
|
$this->assertEqual($count, count($this->dbh));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMultipleFetching() {
|
|
||||||
$count = $this->dbh->count();
|
|
||||||
$this->session->getTable('User')->clear();
|
|
||||||
$this->session->getTable('Email')->clear();
|
|
||||||
$this->session->getTable('Phonenumber')->clear();
|
|
||||||
|
|
||||||
$users = $this->query->from("User-l.Phonenumber-i, User-l:Email-i")->execute();
|
|
||||||
$this->assertEqual(($count + 1),$this->dbh->count());
|
|
||||||
$this->assertEqual(count($users), 8);
|
|
||||||
|
|
||||||
$this->assertEqual($users[0]->Phonenumber->count(), 1);
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
$this->assertEqual($users[0]->Phonenumber[0]->phonenumber, "123 123");
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
|
|
||||||
$this->assertEqual($users[1]->Phonenumber->count(), 3);
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
$this->assertEqual($users[1]->Phonenumber[0]->phonenumber, "123 123");
|
|
||||||
$this->assertEqual($users[1]->Phonenumber[1]->phonenumber, "456 456");
|
|
||||||
$this->assertEqual($users[1]->Phonenumber[2]->phonenumber, "789 789");
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
|
|
||||||
$this->assertEqual($users[7]->Phonenumber->count(), 1);
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
$this->assertEqual($users[7]->Phonenumber[0]->phonenumber, "111 567 333");
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
|
|
||||||
$this->assertTrue($users[0]->Email instanceof Email);
|
|
||||||
$this->assertEqual($users[0]->Email->address, "zYne@example.com");
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
$this->assertEqual($users[0]->email_id, $users[0]->Email->id);
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
|
|
||||||
$this->assertTrue($users[1]->Email instanceof Email);
|
|
||||||
$this->assertEqual($users[1]->Email->address, "arnold@example.com");
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
$this->assertEqual($users[1]->email_id, $users[1]->Email->id);
|
|
||||||
$this->assertEqual(($count + 1), $this->dbh->count());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testForeignKeyRelationFetching() {
|
public function testForeignKeyRelationFetching() {
|
||||||
$count = $this->dbh->count();
|
$count = $this->dbh->count();
|
||||||
@ -870,7 +872,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
|
|||||||
|
|
||||||
$board->getTable()->clear();
|
$board->getTable()->clear();
|
||||||
|
|
||||||
$board = $board->getTable()->find($board->getID());
|
$board = $board->getTable()->find($board->id);
|
||||||
$this->assertEqual($board->Threads->count(), 1);
|
$this->assertEqual($board->Threads->count(), 1);
|
||||||
$this->assertEqual($board->name, "Doctrine Forum");
|
$this->assertEqual($board->name, "Doctrine Forum");
|
||||||
$this->assertEqual($board->Category->name, "General discussion");
|
$this->assertEqual($board->Category->name, "General discussion");
|
||||||
@ -1189,5 +1191,6 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
|
|||||||
//$this->assertTrue(isset($values['max']));
|
//$this->assertTrue(isset($values['max']));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -7,6 +7,12 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
parent::prepareTables();
|
parent::prepareTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testReferences2() {
|
||||||
|
$user = new User();
|
||||||
|
$user->Phonenumber[0]->phonenumber = '123 123';
|
||||||
|
$this->assertEqual($user->Phonenumber[0]->entity_id, $user);
|
||||||
|
}
|
||||||
|
|
||||||
public function testJoinTableSelfReferencing() {
|
public function testJoinTableSelfReferencing() {
|
||||||
$e = new Entity();
|
$e = new Entity();
|
||||||
$e->name = "Entity test";
|
$e->name = "Entity test";
|
||||||
@ -54,8 +60,9 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
|
|
||||||
$this->assertEqual($e->Entity[0]->getState(), Doctrine_Record::STATE_CLEAN);
|
$this->assertEqual($e->Entity[0]->getState(), Doctrine_Record::STATE_CLEAN);
|
||||||
$this->assertEqual($e->Entity[1]->getState(), Doctrine_Record::STATE_CLEAN);
|
$this->assertEqual($e->Entity[1]->getState(), Doctrine_Record::STATE_CLEAN);
|
||||||
|
|
||||||
|
|
||||||
$e = $e->getTable()->find($e->getID());
|
$e = $e->getTable()->find($e->id);
|
||||||
|
|
||||||
$this->assertTrue($e->Entity[0] instanceof Entity);
|
$this->assertTrue($e->Entity[0] instanceof Entity);
|
||||||
$this->assertTrue($e->Entity[1] instanceof Entity);
|
$this->assertTrue($e->Entity[1] instanceof Entity);
|
||||||
@ -256,7 +263,7 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
$account = $user->Account;
|
$account = $user->Account;
|
||||||
$this->assertTrue($account instanceof Account);
|
$this->assertTrue($account instanceof Account);
|
||||||
$this->assertEqual($account->getState(), Doctrine_Record::STATE_CLEAN);
|
$this->assertEqual($account->getState(), Doctrine_Record::STATE_CLEAN);
|
||||||
$this->assertEqual($account->entity_id, $user->getID());
|
$this->assertEqual($account->entity_id, $user->id);
|
||||||
$this->assertEqual($account->amount, 1000);
|
$this->assertEqual($account->amount, 1000);
|
||||||
$this->assertEqual($user->name, "Richard Linklater");
|
$this->assertEqual($user->name, "Richard Linklater");
|
||||||
|
|
||||||
@ -272,11 +279,11 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
$this->assertTrue($account instanceof Account);
|
$this->assertTrue($account instanceof Account);
|
||||||
|
|
||||||
$this->assertEqual($account->getTable()->getColumnNames(), array("id","entity_id","amount"));
|
$this->assertEqual($account->getTable()->getColumnNames(), array("id","entity_id","amount"));
|
||||||
$this->assertEqual($account->entity_id, $user->getID());
|
$this->assertEqual($account->entity_id, $user->id);
|
||||||
$this->assertEqual($account->amount, 2000);
|
$this->assertEqual($account->amount, 2000);
|
||||||
|
|
||||||
|
|
||||||
$user = $user->getTable()->find($user->getID());
|
$user = $user->getTable()->find($user->id);
|
||||||
$this->assertEqual($user->getState(), Doctrine_Record::STATE_CLEAN);
|
$this->assertEqual($user->getState(), Doctrine_Record::STATE_CLEAN);
|
||||||
|
|
||||||
|
|
||||||
@ -286,7 +293,7 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
$this->assertEqual($account->getState(), Doctrine_Record::STATE_CLEAN);
|
$this->assertEqual($account->getState(), Doctrine_Record::STATE_CLEAN);
|
||||||
$this->assertEqual($account->getTable()->getColumnNames(), array("id","entity_id","amount"));
|
$this->assertEqual($account->getTable()->getColumnNames(), array("id","entity_id","amount"));
|
||||||
|
|
||||||
$this->assertEqual($account->entity_id, $user->getID());
|
$this->assertEqual($account->entity_id, $user->id);
|
||||||
$this->assertEqual($account->amount, 2000);
|
$this->assertEqual($account->amount, 2000);
|
||||||
$this->assertEqual($user->name, "John Rambo");
|
$this->assertEqual($user->name, "John Rambo");
|
||||||
|
|
||||||
@ -512,22 +519,32 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
$coll = new Doctrine_Collection($pf);
|
$coll = new Doctrine_Collection($pf);
|
||||||
|
|
||||||
$user->Phonenumber = $coll;
|
$user->Phonenumber = $coll;
|
||||||
$this->assertTrue($user->Phonenumber->count() == 0);
|
$this->assertEqual($user->Phonenumber->count(), 0);
|
||||||
$user->save();
|
$user->save();
|
||||||
unset($user);
|
|
||||||
|
$user->getTable()->clear();
|
||||||
|
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
|
|
||||||
$this->assertEqual($user->Phonenumber->count(), 0);
|
$this->assertEqual($user->Phonenumber->count(), 0);
|
||||||
|
|
||||||
|
$this->assertEqual(get_class($user->Phonenumber), "Doctrine_Collection_Immediate");
|
||||||
|
|
||||||
|
$user->Phonenumber[0]->phonenumber;
|
||||||
|
$this->assertEqual($user->Phonenumber->count(), 1);
|
||||||
|
|
||||||
// ADDING REFERENCES
|
// ADDING REFERENCES
|
||||||
|
|
||||||
$user->Phonenumber[0]->phonenumber = "123 123";
|
$user->Phonenumber[0]->phonenumber = "123 123";
|
||||||
|
|
||||||
|
$this->assertEqual($user->Phonenumber->count(), 1);
|
||||||
$user->Phonenumber[1]->phonenumber = "123 123";
|
$user->Phonenumber[1]->phonenumber = "123 123";
|
||||||
|
$this->assertEqual($user->Phonenumber->count(), 2);
|
||||||
|
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
|
|
||||||
$this->assertTrue($user->Phonenumber->count() == 2);
|
$this->assertEqual($user->Phonenumber->count(), 2);
|
||||||
|
|
||||||
unset($user);
|
unset($user);
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
@ -536,30 +553,30 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
$user->Phonenumber[3]->phonenumber = "123 123";
|
$user->Phonenumber[3]->phonenumber = "123 123";
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
$this->assertTrue($user->Phonenumber->count() == 3);
|
$this->assertEqual($user->Phonenumber->count(), 3);
|
||||||
unset($user);
|
unset($user);
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
$this->assertTrue($user->Phonenumber->count() == 3);
|
$this->assertEqual($user->Phonenumber->count(), 3);
|
||||||
|
|
||||||
// DELETING REFERENCES
|
// DELETING REFERENCES
|
||||||
|
|
||||||
$user->Phonenumber->delete();
|
$user->Phonenumber->delete();
|
||||||
|
|
||||||
$this->assertTrue($user->Phonenumber->count() == 0);
|
$this->assertEqual($user->Phonenumber->count(), 0);
|
||||||
unset($user);
|
unset($user);
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
$this->assertTrue($user->Phonenumber->count() == 0);
|
$this->assertEqual($user->Phonenumber->count(), 0);
|
||||||
|
|
||||||
// ADDING REFERENCES WITH STRING KEYS
|
// ADDING REFERENCES WITH STRING KEYS
|
||||||
|
|
||||||
$user->Phonenumber["home"]->phonenumber = "123 123";
|
$user->Phonenumber["home"]->phonenumber = "123 123";
|
||||||
$user->Phonenumber["work"]->phonenumber = "444 444";
|
$user->Phonenumber["work"]->phonenumber = "444 444";
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
$this->assertTrue($user->Phonenumber->count() == 2);
|
$this->assertEqual($user->Phonenumber->count(), 2);
|
||||||
unset($user);
|
unset($user);
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
$this->assertTrue($user->Phonenumber->count() == 2);
|
$this->assertEqual($user->Phonenumber->count(), 2);
|
||||||
|
|
||||||
// REPLACING ONE-TO-MANY REFERENCE
|
// REPLACING ONE-TO-MANY REFERENCE
|
||||||
unset($coll);
|
unset($coll);
|
||||||
@ -586,15 +603,15 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
|
|
||||||
$this->assertTrue($user->Email instanceof Email);
|
$this->assertTrue($user->Email instanceof Email);
|
||||||
$this->assertEqual($user->Email->address, "drinker@drinkmore.info");
|
$this->assertEqual($user->Email->address, "drinker@drinkmore.info");
|
||||||
$this->assertEqual($user->Email->getID(), $user->email_id);
|
$this->assertEqual($user->Email->id, $user->email_id);
|
||||||
|
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
|
|
||||||
$this->assertTrue($user->Email instanceof Email);
|
$this->assertTrue($user->Email instanceof Email);
|
||||||
$this->assertEqual($user->Email->getID(), $user->email_id);
|
$this->assertEqual($user->Email->id, $user->email_id);
|
||||||
$this->assertEqual($user->Email->getState(), Doctrine_Record::STATE_CLEAN);
|
$this->assertEqual($user->Email->getState(), Doctrine_Record::STATE_CLEAN);
|
||||||
$this->assertEqual($user->Email->address, "drinker@drinkmore.info");
|
$this->assertEqual($user->Email->address, "drinker@drinkmore.info");
|
||||||
$id = $user->Email->getID();
|
$id = $user->Email->id;
|
||||||
|
|
||||||
// REPLACING ONE-TO-ONE REFERENCES
|
// REPLACING ONE-TO-ONE REFERENCES
|
||||||
|
|
||||||
@ -744,5 +761,6 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
$user = $this->session->getTable("User")->find(4);
|
$user = $this->session->getTable("User")->find(4);
|
||||||
$this->assertTrue($user->getIterator() instanceof ArrayIterator);
|
$this->assertTrue($user->getIterator() instanceof ArrayIterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -136,11 +136,11 @@ class Doctrine_SessionTestCase extends Doctrine_UnitTestCase {
|
|||||||
$this->assertEqual(count($user->Group), 2);
|
$this->assertEqual(count($user->Group), 2);
|
||||||
$user2 = $user;
|
$user2 = $user;
|
||||||
|
|
||||||
$user = $this->objTable->find($user->getID());
|
$user = $this->objTable->find($user->id);
|
||||||
|
|
||||||
$this->assertEqual($user->getID(), $user2->getID());
|
$this->assertEqual($user->id, $user2->id);
|
||||||
|
|
||||||
$this->assertTrue(is_numeric($user->getID()));
|
$this->assertTrue(is_numeric($user->id));
|
||||||
$this->assertTrue(is_numeric($user->email_id));
|
$this->assertTrue(is_numeric($user->email_id));
|
||||||
|
|
||||||
$this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id));
|
$this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id));
|
||||||
@ -176,7 +176,7 @@ class Doctrine_SessionTestCase extends Doctrine_UnitTestCase {
|
|||||||
$this->session->flush();
|
$this->session->flush();
|
||||||
|
|
||||||
|
|
||||||
$this->assertTrue($user->Phonenumber->count() == 2);
|
$this->assertEqual($user->Phonenumber->count(), 2);
|
||||||
|
|
||||||
unset($user);
|
unset($user);
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
@ -185,19 +185,19 @@ class Doctrine_SessionTestCase extends Doctrine_UnitTestCase {
|
|||||||
$user->Phonenumber[3]->phonenumber = "123 123";
|
$user->Phonenumber[3]->phonenumber = "123 123";
|
||||||
$this->session->flush();
|
$this->session->flush();
|
||||||
|
|
||||||
$this->assertTrue($user->Phonenumber->count() == 3);
|
$this->assertEqual($user->Phonenumber->count(), 3);
|
||||||
unset($user);
|
unset($user);
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
$this->assertTrue($user->Phonenumber->count() == 3);
|
$this->assertEqual($user->Phonenumber->count(), 3);
|
||||||
|
|
||||||
// DELETING REFERENCES
|
// DELETING REFERENCES
|
||||||
|
|
||||||
$user->Phonenumber->delete();
|
$user->Phonenumber->delete();
|
||||||
|
|
||||||
$this->assertTrue($user->Phonenumber->count() == 0);
|
$this->assertEqual($user->Phonenumber->count(), 0);
|
||||||
unset($user);
|
unset($user);
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
$this->assertTrue($user->Phonenumber->count() == 0);
|
$this->assertEqual($user->Phonenumber->count(), 0);
|
||||||
|
|
||||||
// ADDING REFERENCES WITH STRING KEYS
|
// ADDING REFERENCES WITH STRING KEYS
|
||||||
|
|
||||||
@ -207,10 +207,10 @@ class Doctrine_SessionTestCase extends Doctrine_UnitTestCase {
|
|||||||
$this->assertEqual($user->Phonenumber->count(), 2);
|
$this->assertEqual($user->Phonenumber->count(), 2);
|
||||||
$this->session->flush();
|
$this->session->flush();
|
||||||
|
|
||||||
$this->assertTrue($user->Phonenumber->count() == 2);
|
$this->assertEqual($user->Phonenumber->count(), 2);
|
||||||
unset($user);
|
unset($user);
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
$this->assertTrue($user->Phonenumber->count() == 2);
|
$this->assertEqual($user->Phonenumber->count(), 2);
|
||||||
|
|
||||||
// REPLACING ONE-TO-MANY REFERENCE
|
// REPLACING ONE-TO-MANY REFERENCE
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ class Doctrine_SessionTestCase extends Doctrine_UnitTestCase {
|
|||||||
$this->assertTrue($user->Email instanceof Email);
|
$this->assertTrue($user->Email instanceof Email);
|
||||||
$user = $this->objTable->find(5);
|
$user = $this->objTable->find(5);
|
||||||
$this->assertEqual($user->Email->address, "drinker@drinkmore.info");
|
$this->assertEqual($user->Email->address, "drinker@drinkmore.info");
|
||||||
$id = $user->Email->getID();
|
$id = $user->Email->id;
|
||||||
|
|
||||||
// REPLACING ONE-TO-ONE REFERENCES
|
// REPLACING ONE-TO-ONE REFERENCES
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user