Ticket #1436 (closed defect: fixed)

Opened 10 months ago

Last modified 9 months ago

synchronizeWithArray fails with m:n relations and transient objects

Reported by: jasoneisen Owned by: romanb
Priority: minor Milestone: 1.1.0-ALPHA1
Component: Record Version: 1.0.0
Severity: Keywords:
Cc: Has Test: yes
Status: Pending User Response Has Patch: yes

Description (last modified by jasoneisen) (diff)

Fixes SynchronizeWithArray?() to work with m2m relations. Fixes an already failing test case dealing with this method as well.

Requires an additional argument added to link and unlink to postpone to later, with protected storage vars for pending links and unlinks which are later called by unitofwork on save().

Also fixes unlinking not going ahead and removing references in memory when the keys array is empty.

Usage pasted from test case:

$user = Doctrine_Query::create()->from('User u')->fetchOne();
$userArray = array(
    'Group' => array(
        '_identifiers' => array(
            $this->group_one => '1',
            $this->group_two => '1',
            $this->group_three => ''
            )
    ));

$user->synchronizeWithArray($userArray);

The protected vars are probably redundant and could be reduced to one, with one getter/setter.

Attachments

1436.diff (11.1 KB) - added by jasoneisen 10 months ago.

Change History

Changed 10 months ago by jasoneisen

  • has_patch set
  • description modified (diff)
  • has_test set

Changed 10 months ago by jasoneisen

  • mystatus changed from Pending Core Response to Pending User Response

Changed 10 months ago by jasoneisen

I want to modify the current diff, give me a few days.

Changed 10 months ago by jwage

  • milestone changed from 1.1.0 to 1.0.1

Changed 10 months ago by jasoneisen

Changed 10 months ago by jwage

  • milestone changed from 1.0.1 to 1.0.2

Changed 10 months ago by jwage

This change will require some other tickets to be fixed. The changes required are just too large to do in the 1.0.x so we'll have to do it for 1.1

Changed 10 months ago by jwage

  • milestone changed from 1.0.3 to 1.1.0

Changed 9 months ago by jwage

  • status changed from new to closed
  • resolution set to fixed

Fixed by r5019

Note: See TracTickets for help on using tickets.