#1622: Record->unlink() fails if relation was not used before
-----------------------+----------------------------------------------------
  Reporter:  floriank  |       Owner:  romanb               
      Type:  defect    |      Status:  new                  
  Priority:  major     |   Milestone:  1.0.5                
 Component:  Record    |     Version:  1.1-DEV              
Resolution:            |    Keywords:  unlink               
  Has_test:  1         |    Mystatus:  Pending Core Response
 Has_patch:  1         |  
-----------------------+----------------------------------------------------
Comment (by floriank):

 Replying to [comment:4 jwage]:
 >I think hasReference() should remain the same, and the unlink() function
 should load it if it doesn't exist.

 You think of something like this?

 {{{
 Index: lib/Doctrine/Record.php
 ===================================================================
 --- lib/Doctrine/Record.php     (revision 5155)
 +++ lib/Doctrine/Record.php     (working copy)
 @@ -2103,6 +2103,11 @@
      {
          $ids = (array) $ids;

 +        // fix for #1622
 +        if (!isset($this->_references[$alias]) &&
 $this->hasRelation($alias)) {
 +            $this->loadReference($alias);
 +        }
 +
          if (isset($this->_references[$alias])) {
              foreach ($this->_references[$alias] as $k => $record) {
                  if (in_array(current($record->identifier()), $ids) ||
 empty($ids)) {

 }}}

 > When you report patches can you run it against the test suite and report
 whether it was successful or not. This will help with me reviewing and
 giving my opinion without having to apply the patch and check myself.

 No problem: I'm running every patch against the testsuite before
 attatching it to a ticket, but till now I reported the results only if
 they break some other tests. For this ticket: Neither the first nor the
 changed patch breaks a testcase from the suite.

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1622#comment:5>
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