Show
Ignore:
Timestamp:
10/05/07 15:45:53 (15 months ago)
Author:
jwage
Message:

Fixes to loading models and made it so Builder can generate abstract classes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/Doctrine.php

    r2716 r2720  
    443443    { 
    444444        $declared = get_declared_classes(); 
    445  
     445         
    446446        if ($directory !== null) { 
    447447            foreach ((array) $directory as $dir) { 
     
    484484        foreach ($classes as $name) { 
    485485            $class = new ReflectionClass($name); 
    486             $conn  = Doctrine_Manager::getInstance()->getConnectionForComponent($name); 
    487             // check if class is an instance of Doctrine_Record and not abstract 
    488             // class must have method setTableDefinition (to avoid non-Record subclasses like symfony's sfDoctrineRecord) 
    489             // we have to recursively iterate through the class parents just to be sure that the classes using for example 
    490             // column aggregation inheritance are properly exported to database 
    491             while ($class->isAbstract() || 
    492                    ! $class->isSubclassOf($parent) || 
    493                    ! $class->hasMethod('setTableDefinition') || 
    494                    ( $class->hasMethod('setTableDefinition') && 
    495                      $class->getMethod('setTableDefinition')->getDeclaringClass()->getName() !== $class->getName())) { 
    496  
    497                 $class = $class->getParentClass(); 
    498                 if ($class === false) { 
    499                     break; 
    500                 } 
    501             } 
    502486             
    503             if ($class === false) { 
     487            // Skip the following classes 
     488            // - abstract classes 
     489            // - not a subclass of Doctrine_Record  
     490            // - don't have a setTableDefinition method 
     491            if ($class->isAbstract() ||  
     492                !$class->isSubClassOf($parent) ||  
     493                !$class->hasMethod('setTableDefinition')) { 
    504494                continue; 
    505495            }