Changeset 4704

Show
Ignore:
Timestamp:
07/23/08 21:19:40 (4 months ago)
Author:
guilhermeblanco
Message:

Merged changeset r4696 into 1.0 branch

Location:
branches/1.0/lib/Doctrine
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Connection/UnitOfWork.php

    r4487 r4704  
    5252 
    5353        $state = $record->state(); 
    54         if ($state === Doctrine_Record::STATE_LOCKED) { 
     54        if ($state === Doctrine_Record::STATE_LOCKED || $state === Doctrine_Record::STATE_TLOCKED) { 
    5555            return false; 
    5656        } 
    5757 
    58         $record->state(Doctrine_Record::STATE_LOCKED); 
     58        $record->state($record->exists() ? Doctrine_Record::STATE_LOCKED : Doctrine_Record::STATE_TLOCKED); 
    5959 
    6060        $conn->beginInternalTransaction(); 
     
    9797        $state = $record->state(); 
    9898 
    99         $record->state(Doctrine_Record::STATE_LOCKED); 
     99        $record->state($record->exists() ? Doctrine_Record::STATE_LOCKED : Doctrine_Record::STATE_TLOCKED); 
    100100 
    101101        foreach ($saveLater as $fk) { 
  • branches/1.0/lib/Doctrine/Record.php

    r4652 r4704  
    7979    const STATE_LOCKED     = 6; 
    8080 
     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; 
     89 
     90 
    8191    /** 
    8292     * @var Doctrine_Node_<TreeImpl>        node object 
     
    668678        $err = false; 
    669679        if (is_integer($state)) { 
    670             if ($state >= 1 && $state <= 6) { 
     680            if ($state >= 1 && $state <= 7) { 
    671681                $this->_state = $state; 
    672682            } else { 
     
    12911301    public function toArray($deep = true, $prefixKey = false) 
    12921302    { 
    1293         if ($this->_state == self::STATE_LOCKED) { 
     1303        if ($this->_state == self::STATE_LOCKED || $this->_state == self::STATE_TLOCKED) { 
    12941304            return false; 
    12951305        } 
    12961306         
    12971307        $stateBeforeLock = $this->_state; 
    1298         $this->_state = self::STATE_LOCKED; 
     1308        $this->_state = $this->exists() ? self::STATE_LOCKED : self::STATE_TLOCKED; 
    12991309         
    13001310        $a = array(); 
     
    14651475    { 
    14661476        return ($this->_state !== Doctrine_Record::STATE_TCLEAN && 
    1467                 $this->_state !== Doctrine_Record::STATE_TDIRTY); 
     1477                $this->_state !== Doctrine_Record::STATE_TDIRTY && 
     1478                $this->_state !== Doctrine_Record::STATE_TLOCKED); 
    14681479    } 
    14691480 
     
    19251936    public function free($deep = false) 
    19261937    { 
    1927         if ($this->_state != self::STATE_LOCKED) { 
    1928             $this->_state = self::STATE_LOCKED; 
     1938        if ($this->_state != self::STATE_LOCKED && $this->_state != self::STATE_TLOCKED) { 
     1939            $this->_state = $this->exists() ? self::STATE_LOCKED : self::STATE_TLOCKED; 
    19291940 
    19301941            $this->_table->getRepository()->evict($this->_oid);