Changeset 4586

Show
Ignore:
Timestamp:
06/28/08 08:13:34 (12 months ago)
Author:
jwage
Message:

fixes #950

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Relation/Parser.php

    r4502 r4586  
    198198                if (isset($def['localKey'])) { 
    199199                    $rel = new Doctrine_Relation_LocalKey($def); 
     200 
     201                    // Automatically index foreign keys which are not primary 
     202                    $foreign = (array) $def['foreign']; 
     203                    foreach ($foreign as $fk) { 
     204                        if ( ! $rel->getTable()->isIdentifier($fk)) { 
     205                            $rel->getTable()->addIndex($fk, array('fields' => array($fk))); 
     206                        } 
     207                    } 
    200208                } else { 
    201209                    $rel = new Doctrine_Relation_ForeignKey($def);