Removed some remainders from the old validation behaviour. This fixes a bug where records dont get inserted.
This commit is contained in:
parent
765c06b7c1
commit
2e8f73dba1
@ -56,10 +56,6 @@ class Doctrine_Connection_Transaction implements Countable, IteratorAggregate {
|
|||||||
* @var integer $transaction_level the nesting level of transactions, used by transaction methods
|
* @var integer $transaction_level the nesting level of transactions, used by transaction methods
|
||||||
*/
|
*/
|
||||||
private $transaction_level = 0;
|
private $transaction_level = 0;
|
||||||
/**
|
|
||||||
* @var Doctrine_Validator $validator transaction validator
|
|
||||||
*/
|
|
||||||
private $validator;
|
|
||||||
/**
|
/**
|
||||||
* @var array $invalid an array containing all invalid records within this transaction
|
* @var array $invalid an array containing all invalid records within this transaction
|
||||||
*/
|
*/
|
||||||
@ -114,8 +110,6 @@ class Doctrine_Connection_Transaction implements Countable, IteratorAggregate {
|
|||||||
*/
|
*/
|
||||||
public function beginTransaction() {
|
public function beginTransaction() {
|
||||||
if($this->transaction_level == 0) {
|
if($this->transaction_level == 0) {
|
||||||
if($this->conn->getAttribute(Doctrine::ATTR_VLD))
|
|
||||||
$this->validator = new Doctrine_Validator();
|
|
||||||
|
|
||||||
if($this->conn->getAttribute(Doctrine::ATTR_LOCKMODE) == Doctrine::LOCK_PESSIMISTIC) {
|
if($this->conn->getAttribute(Doctrine::ATTR_LOCKMODE) == Doctrine::LOCK_PESSIMISTIC) {
|
||||||
$this->conn->getAttribute(Doctrine::ATTR_LISTENER)->onPreTransactionBegin($this->conn);
|
$this->conn->getAttribute(Doctrine::ATTR_LISTENER)->onPreTransactionBegin($this->conn);
|
||||||
@ -177,7 +171,6 @@ class Doctrine_Connection_Transaction implements Countable, IteratorAggregate {
|
|||||||
$this->conn->getAttribute(Doctrine::ATTR_LISTENER)->onTransactionCommit($this->conn);
|
$this->conn->getAttribute(Doctrine::ATTR_LISTENER)->onTransactionCommit($this->conn);
|
||||||
|
|
||||||
$this->state = Doctrine_Connection_Transaction::STATE_OPEN;
|
$this->state = Doctrine_Connection_Transaction::STATE_OPEN;
|
||||||
$this->validator = null;
|
|
||||||
$this->invalid = array();
|
$this->invalid = array();
|
||||||
|
|
||||||
} elseif($this->transaction_level == 1)
|
} elseif($this->transaction_level == 1)
|
||||||
@ -258,12 +251,6 @@ class Doctrine_Connection_Transaction implements Countable, IteratorAggregate {
|
|||||||
}
|
}
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
if(isset($this->validator)) {
|
|
||||||
if( ! $this->validator->validateRecord($record)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = array_values($array);
|
$params = array_values($array);
|
||||||
$id = $record->obtainIdentifier();
|
$id = $record->obtainIdentifier();
|
||||||
|
|
||||||
@ -315,12 +302,6 @@ class Doctrine_Connection_Transaction implements Countable, IteratorAggregate {
|
|||||||
$array[$name] = $id;
|
$array[$name] = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->validator)) {
|
|
||||||
if( ! $this->validator->validateRecord($record)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$strfields = join(", ", array_keys($array));
|
$strfields = join(", ", array_keys($array));
|
||||||
$strvalues = substr(str_repeat("?, ",count($array)),0,-2);
|
$strvalues = substr(str_repeat("?, ",count($array)),0,-2);
|
||||||
$sql = "INSERT INTO ".$record->getTable()->getTableName()." (".$strfields.") VALUES (".$strvalues.")";
|
$sql = "INSERT INTO ".$record->getTable()->getTableName()." (".$strfields.") VALUES (".$strvalues.")";
|
||||||
|
Loading…
Reference in New Issue
Block a user