Changeset 3949

Show
Ignore:
Timestamp:
03/08/08 05:10:52 (16 months ago)
Author:
jwage
Message:

fixes #827

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.10/lib/Doctrine/Table.php

    r3945 r3949  
    945945         
    946946        // extract column name & field name 
    947         $parts = explode(' as ', $name); 
    948         if (count($parts) > 1) { 
    949             $fieldName = $parts[1]; 
     947        if (stripos($name, ' as ')) 
     948        { 
     949            if (strpos($name, ' as')) { 
     950                $parts = explode(' as ', $name); 
     951            } else { 
     952                $parts = explode(' AS ', $name); 
     953            } 
     954             
     955            if (count($parts) > 1) { 
     956                $fieldName = $parts[1]; 
     957            } else { 
     958                $fieldName = $parts[0]; 
     959            } 
     960             
     961            $name = strtolower($parts[0]); 
    950962        } else { 
    951             $fieldName = $parts[0]; 
    952         } 
    953         $name = strtolower($parts[0]); 
     963            $fieldName = $name; 
     964            $name = strtolower($name); 
     965        } 
     966         
     967        $name = trim($name); 
     968        $fieldName = trim($fieldName); 
     969         
    954970        if ($prepend) { 
    955971            $this->_columnNames = array_merge(array($fieldName => $name), $this->_columnNames);