Doctrine_Record_Exception: better handling of error messages
This commit is contained in:
parent
9c34cb2937
commit
7f5844d1db
@ -272,8 +272,6 @@ class Doctrine_Hydrate extends Doctrine_Access {
|
||||
if($return == Doctrine::RETURN_VHOLDER) {
|
||||
return $this->hydrateHolders($array);
|
||||
}
|
||||
|
||||
$colls = array();
|
||||
|
||||
foreach($array as $data) {
|
||||
/**
|
||||
|
@ -491,7 +491,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
||||
$this->prepareIdentifiers();
|
||||
|
||||
if($this->id != $old)
|
||||
throw new Doctrine_Record_Exception();
|
||||
throw new Doctrine_Record_Exception("The refreshed primary key doesn't match the one in the record memory.", Doctrine::ERR_REFRESH);
|
||||
|
||||
$this->state = Doctrine_Record::STATE_CLEAN;
|
||||
$this->modified = array();
|
||||
@ -679,7 +679,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
||||
case Doctrine_Relation::MANY_AGGREGATE:
|
||||
// one-to-many relation found
|
||||
if( ! ($value instanceof Doctrine_Collection))
|
||||
throw new Doctrine_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.");
|
||||
throw new Doctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.");
|
||||
|
||||
$value->setReference($this,$fk);
|
||||
break;
|
||||
@ -687,7 +687,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
||||
case Doctrine_Relation::ONE_AGGREGATE:
|
||||
// one-to-one relation found
|
||||
if( ! ($value instanceof Doctrine_Record))
|
||||
throw new Doctrine_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Record when setting one-to-one references.");
|
||||
throw new Doctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Record when setting one-to-one references.");
|
||||
|
||||
if($fk->getLocal() == $this->table->getIdentifier()) {
|
||||
$this->references[$name]->set($fk->getForeign(),$this);
|
||||
@ -700,7 +700,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
||||
} elseif($fk instanceof Doctrine_Association) {
|
||||
// join table relation found
|
||||
if( ! ($value instanceof Doctrine_Collection))
|
||||
throw new Doctrine_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.");
|
||||
throw new Doctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.");
|
||||
}
|
||||
|
||||
$this->references[$name] = $value;
|
||||
|
@ -1,12 +1,5 @@
|
||||
<?php
|
||||
Doctrine::autoload('Doctrine_Exception');
|
||||
/**
|
||||
* thrown when Doctrine_Record is refreshed and the refreshed primary key doens't match the old one
|
||||
*/
|
||||
class Doctrine_Record_Exception extends Doctrine_Exception {
|
||||
public function __construct() {
|
||||
parent::__construct("The refreshed primary key doesn't match the
|
||||
one in the record memory.", Doctrine::ERR_REFRESH);
|
||||
}
|
||||
}
|
||||
|
||||
class Doctrine_Record_Exception extends Doctrine_Exception { }
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user