Doctrine 1
  1. Doctrine 1
  2. DC-698

Record::link method does not work with setting null one-to-one

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.2
    • Fix Version/s: 1.2.3
    • Component/s: None
    • Labels:
      None

      Description

      I have an Issue model with one owner User (relation Owner). I have this code:

      $issue->link( 'Owner', array( $owner_id ) );

      At the time of calling this code, the $issue->Owner is null. When this is called, the link fails to assign the new owner to the relation. I've tried to hotfix it changing line around 2516 in Record.php:

      $this->get($alias)->add($record);

      to this:

      if( $c = $this->get($alias) )

      { $c->add($record); }

      else

      { $this->set( $alias, $record ); }

      In this case the $this->get($alias) returns NULL, so the subsequent add($record) fails.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Martin Cohen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: