1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Removed some remainders from the old validation behaviour. This fixes a bug where records dont get inserted.

This commit is contained in:
romanb 2006-10-13 17:29:22 +00:00
parent 765c06b7c1
commit 2e8f73dba1

View File

@ -56,10 +56,6 @@ class Doctrine_Connection_Transaction implements Countable, IteratorAggregate {
* @var integer $transaction_level the nesting level of transactions, used by transaction methods
*/
private $transaction_level = 0;
/**
* @var Doctrine_Validator $validator transaction validator
*/
private $validator;
/**
* @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() {
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) {
$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->state = Doctrine_Connection_Transaction::STATE_OPEN;
$this->validator = null;
$this->invalid = array();
} elseif($this->transaction_level == 1)
@ -258,12 +251,6 @@ class Doctrine_Connection_Transaction implements Countable, IteratorAggregate {
}
endforeach;
if(isset($this->validator)) {
if( ! $this->validator->validateRecord($record)) {
return false;
}
}
$params = array_values($array);
$id = $record->obtainIdentifier();
@ -315,12 +302,6 @@ class Doctrine_Connection_Transaction implements Countable, IteratorAggregate {
$array[$name] = $id;
}
if(isset($this->validator)) {
if( ! $this->validator->validateRecord($record)) {
return false;
}
}
$strfields = join(", ", array_keys($array));
$strvalues = substr(str_repeat("?, ",count($array)),0,-2);
$sql = "INSERT INTO ".$record->getTable()->getTableName()." (".$strfields.") VALUES (".$strvalues.")";