This commit is contained in:
parent
a7d1d643f0
commit
2e6d8a9854
@ -112,9 +112,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
*/
|
*/
|
||||||
protected $_filter;
|
protected $_filter;
|
||||||
/**
|
/**
|
||||||
* @var array $references an array containing all the references
|
* @var array $_references an array containing all the references
|
||||||
*/
|
*/
|
||||||
private $references = array();
|
protected $_references = array();
|
||||||
/**
|
/**
|
||||||
* @var integer $index this index is used for creating object identifiers
|
* @var integer $index this index is used for creating object identifiers
|
||||||
*/
|
*/
|
||||||
@ -722,14 +722,14 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ( ! isset($this->references[$name])) {
|
if ( ! isset($this->_references[$name])) {
|
||||||
$this->loadReference($name);
|
$this->loadReference($name);
|
||||||
}
|
}
|
||||||
} catch(Doctrine_Table_Exception $e) {
|
} catch(Doctrine_Table_Exception $e) {
|
||||||
throw new Doctrine_Record_Exception("Unknown property / related component '$name'.");
|
throw new Doctrine_Record_Exception("Unknown property / related component '$name'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->references[$name];
|
return $this->_references[$name];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* mapValue
|
* mapValue
|
||||||
@ -841,7 +841,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->references[$name] = $value;
|
$this->_references[$name] = $value;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* contains
|
* contains
|
||||||
@ -859,7 +859,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
if (isset($this->_id[$lower])) {
|
if (isset($this->_id[$lower])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isset($this->references[$name])) {
|
if (isset($this->_references[$name])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -904,8 +904,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
$table = $fk->getTable();
|
$table = $fk->getTable();
|
||||||
$alias = $this->_table->getAlias($table->getComponentName());
|
$alias = $this->_table->getAlias($table->getComponentName());
|
||||||
|
|
||||||
if (isset($this->references[$alias])) {
|
if (isset($this->_references[$alias])) {
|
||||||
$obj = $this->references[$alias];
|
$obj = $this->_references[$alias];
|
||||||
$obj->save($conn);
|
$obj->save($conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1139,7 +1139,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
public function copyDeep(){
|
public function copyDeep(){
|
||||||
$copy = $this->copy();
|
$copy = $this->copy();
|
||||||
|
|
||||||
foreach ($this->references as $key => $value) {
|
foreach ($this->_references as $key => $value) {
|
||||||
if ($value instanceof Doctrine_Collection) {
|
if ($value instanceof Doctrine_Collection) {
|
||||||
foreach ($value as $record) {
|
foreach ($value as $record) {
|
||||||
$copy->{$key}[] = $record->copyDeep();
|
$copy->{$key}[] = $record->copyDeep();
|
||||||
@ -1218,7 +1218,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
*/
|
*/
|
||||||
public function hasReference($name)
|
public function hasReference($name)
|
||||||
{
|
{
|
||||||
return isset($this->references[$name]);
|
return isset($this->_references[$name]);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* obtainReference
|
* obtainReference
|
||||||
@ -1228,8 +1228,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
*/
|
*/
|
||||||
public function obtainReference($name)
|
public function obtainReference($name)
|
||||||
{
|
{
|
||||||
if (isset($this->references[$name])) {
|
if (isset($this->_references[$name])) {
|
||||||
return $this->references[$name];
|
return $this->_references[$name];
|
||||||
}
|
}
|
||||||
throw new Doctrine_Record_Exception("Unknown reference $name");
|
throw new Doctrine_Record_Exception("Unknown reference $name");
|
||||||
}
|
}
|
||||||
@ -1239,7 +1239,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
*/
|
*/
|
||||||
public function getReferences()
|
public function getReferences()
|
||||||
{
|
{
|
||||||
return $this->references;
|
return $this->_references;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* setRelated
|
* setRelated
|
||||||
@ -1249,7 +1249,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
*/
|
*/
|
||||||
final public function setRelated($alias, Doctrine_Access $coll)
|
final public function setRelated($alias, Doctrine_Access $coll)
|
||||||
{
|
{
|
||||||
$this->references[$alias] = $coll;
|
$this->_references[$alias] = $coll;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* loadReference
|
* loadReference
|
||||||
@ -1265,11 +1265,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
$fk = $this->_table->getRelation($name);
|
$fk = $this->_table->getRelation($name);
|
||||||
|
|
||||||
if ($fk->isOneToOne()) {
|
if ($fk->isOneToOne()) {
|
||||||
$this->references[$name] = $fk->fetchRelatedFor($this);
|
$this->_references[$name] = $fk->fetchRelatedFor($this);
|
||||||
} else {
|
} else {
|
||||||
$coll = $fk->fetchRelatedFor($this);
|
$coll = $fk->fetchRelatedFor($this);
|
||||||
|
|
||||||
$this->references[$name] = $coll;
|
$this->_references[$name] = $coll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user