Changeset 4316

Show
Ignore:
Timestamp:
04/30/08 19:17:42 (14 months ago)
Author:
jwage
Message:

fixed issue with order in which actAs() tries to find the template for the behavior causing all registered autoloaders to be called every single time.

Files:
1 modified

Legend:

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

    r4252 r4316  
    313313    { 
    314314        if ( ! is_object($tpl)) { 
    315             if (class_exists($tpl, true)) { 
     315            $className = 'Doctrine_Template_' . $tpl; 
     316 
     317            if (class_exists($className, true)) { 
     318                $tpl = new $className($options); 
     319            } else if (class_exists($tpl, true)) { 
    316320                $tpl = new $tpl($options); 
    317321            } else { 
    318                 $className = 'Doctrine_Template_' . $tpl; 
    319  
    320                 if ( ! class_exists($className, true)) { 
    321                     throw new Doctrine_Record_Exception("Couldn't load plugin."); 
    322                 } 
    323  
    324  
    325                 $tpl = new $className($options); 
     322                throw new Doctrine_Record_Exception('Could not load behavior named: "' . $tpl . '"'); 
    326323            } 
    327324        } 
    328325 
    329326        if ( ! ($tpl instanceof Doctrine_Template)) { 
    330             throw new Doctrine_Record_Exception('Loaded plugin class is not an istance of Doctrine_Template.'); 
     327            throw new Doctrine_Record_Exception('Loaded behavior class is not an istance of Doctrine_Template.'); 
    331328        } 
    332329