#1648: Saving of related records does not always work
-----------------------------------+----------------------------------------
 Reporter:  piccoloprincipe        |       Owner:  jwage  
     Type:  defect                 |      Status:  new    
 Priority:  major                  |   Milestone:  Unknown
Component:  Attributes             |     Version:  1.1-DEV
 Keywords:                         |    Has_test:  0      
 Mystatus:  Pending Core Response  |   Has_patch:  0      
-----------------------------------+----------------------------------------
 As you can see at
 http://svn.phpdoctrine.org/branches/1.1/lib/Doctrine/Connection/UnitOfWork.php
 at the time of this post, in method saveRelated() we have:
 {{{
                     $id = array_values($obj->identifier());

                     if ( ! empty($id)) {
                         foreach ((array) $rel->getLocal() as $k => $field)
 {
                             if (isset($id[$k]) && $id[$k] &&
 $record->getTable()->hasField($k)) {
                                 $record->set($field, $id[$k]);
                             }
                         }
                     }
 }}}
 where $obj is a Doctrine_Record set on a relation of the record being
 saved (that has a foreign key that as to be set as the value of primary
 key of $obj). The line:
 {{{
                             if (isset($id[$k]) && $id[$k] &&
 $record->getTable()->hasField($k)) {
 }}}
 should be:
 {{{
                             if (isset($id[$k]) && $id[$k] &&
 $record->getTable()->hasField($field)) {
 }}}
 As $k is the numeric key of the array and $field is the name of the
 foreign key field.

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1648>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to