Changeset 4576

Show
Ignore:
Timestamp:
06/28/08 04:09:11 (12 months ago)
Author:
jwage
Message:

Fixes setSubClasses() to include children from all levels.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Import/Schema.php

    r4517 r4576  
    481481                // Populate the parents subclasses 
    482482                if ($definition['inheritance']['type'] == 'column_aggregation') { 
    483                     $array[$extends]['inheritance']['subclasses'][$definition['className']] = array($definition['inheritance']['keyField'] => $definition['inheritance']['keyValue']); 
     483                    $parent = $this->_findBaseSuperClass($array, $definition['className']); 
     484                    $array[$parent]['inheritance']['subclasses'][$definition['className']] = array($definition['inheritance']['keyField'] => $definition['inheritance']['keyValue']); 
    484485                } 
    485486            } 
     
    487488 
    488489        return $array; 
     490    } 
     491 
     492    /** 
     493     * Find the base super class for this inheritance child. We need to move all levels of children to the 
     494     * top most parent. 
     495     * 
     496     * @param  array  $array  Array of schema information 
     497     * @return string $class  Class to get find the parent for 
     498     */ 
     499    protected function _findBaseSuperClass($array, $class) 
     500    { 
     501        if (isset($array[$class]['inheritance']['extends'])) { 
     502            return $this->_findBaseSuperClass($array, $array[$class]['inheritance']['extends']); 
     503        } else { 
     504            return $class; 
     505        } 
    489506    } 
    490507