Show
Ignore:
Timestamp:
04/30/08 10:25:20 (2 years ago)
Author:
romanb
Message:

each record's errorstack is now initialized lazily to save some memory.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Record.php

    r4300 r4305  
    199199        } 
    200200 
    201         $this->_errorStack = new Doctrine_Validator_ErrorStack(get_class($this)); 
    202  
    203201        $repository = $this->_table->getRepository(); 
    204202        $repository->add($this); 
     
    261259        } 
    262260        // Clear the stack from any previous errors. 
    263         $this->_errorStack->clear(); 
     261        $this->getErrorStack()->clear(); 
    264262 
    265263        // Run validation process 
     
    273271        } 
    274272 
    275         return $this->_errorStack->count() == 0 ? true : false; 
     273        return $this->getErrorStack()->count() == 0 ? true : false; 
    276274    } 
    277275 
     
    395393    public function getErrorStack() 
    396394    { 
     395        if ( ! $this->_errorStack) { 
     396            $this->_errorStack = new Doctrine_Validator_ErrorStack(get_class($this)); 
     397        } 
     398         
    397399        return $this->_errorStack; 
    398400    } 
     
    413415            $this->_errorStack = $stack; 
    414416        } else { 
    415             return $this->_errorStack; 
     417            return $this->getErrorStack(); 
    416418        } 
    417419    }