Changeset 4696
- Timestamp:
- 07/19/08 18:57:36 (5 months ago)
- Location:
- branches/0.11/lib/Doctrine
- Files:
-
- 2 modified
-
Connection/UnitOfWork.php (modified) (2 diffs)
-
Record.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine/Connection/UnitOfWork.php
r4487 r4696 52 52 53 53 $state = $record->state(); 54 if ($state === Doctrine_Record::STATE_LOCKED ) {54 if ($state === Doctrine_Record::STATE_LOCKED || $state === Doctrine_Record::STATE_TLOCKED) { 55 55 return false; 56 56 } 57 57 58 $record->state( Doctrine_Record::STATE_LOCKED);58 $record->state($record->exists() ? Doctrine_Record::STATE_LOCKED : Doctrine_Record::STATE_TLOCKED); 59 59 60 60 $conn->beginInternalTransaction(); … … 97 97 $state = $record->state(); 98 98 99 $record->state( Doctrine_Record::STATE_LOCKED);99 $record->state($record->exists() ? Doctrine_Record::STATE_LOCKED : Doctrine_Record::STATE_TLOCKED); 100 100 101 101 foreach ($saveLater as $fk) { -
branches/0.11/lib/Doctrine/Record.php
r4652 r4696 78 78 */ 79 79 const STATE_LOCKED = 6; 80 81 /** 82 * TLOCKED STATE 83 * a Doctrine_Record is temporarily locked (and transient) during deletes and saves 84 * 85 * This state is used internally to ensure that circular deletes 86 * and saves will not cause infinite loops 87 */ 88 const STATE_TLOCKED = 7; 80 89 81 90 /** … … 668 677 $err = false; 669 678 if (is_integer($state)) { 670 if ($state >= 1 && $state <= 6) {679 if ($state >= 1 && $state <= 7) { 671 680 $this->_state = $state; 672 681 } else { … … 1291 1300 public function toArray($deep = true, $prefixKey = false) 1292 1301 { 1293 if ($this->_state == self::STATE_LOCKED ) {1302 if ($this->_state == self::STATE_LOCKED || $this->_state == self::STATE_TLOCKED) { 1294 1303 return false; 1295 1304 } 1296 1305 1297 1306 $stateBeforeLock = $this->_state; 1298 $this->_state = self::STATE_LOCKED;1307 $this->_state = $this->exists() ? self::STATE_LOCKED : self::STATE_TLOCKED; 1299 1308 1300 1309 $a = array(); … … 1465 1474 { 1466 1475 return ($this->_state !== Doctrine_Record::STATE_TCLEAN && 1467 $this->_state !== Doctrine_Record::STATE_TDIRTY); 1476 $this->_state !== Doctrine_Record::STATE_TDIRTY && 1477 $this->_state !== Doctrine_Record::STATE_TLOCKED); 1468 1478 } 1469 1479 … … 1925 1935 public function free($deep = false) 1926 1936 { 1927 if ($this->_state != self::STATE_LOCKED ) {1928 $this->_state = self::STATE_LOCKED;1937 if ($this->_state != self::STATE_LOCKED && $this->_state != self::STATE_TLOCKED) { 1938 $this->_state = $this->exists() ? self::STATE_LOCKED : self::STATE_TLOCKED; 1929 1939 1930 1940 $this->_table->getRepository()->evict($this->_oid);