Deep copying one-to-one relationships reference extra objects #806

Open
McManning opened this Issue Dec 20, 2013 · 0 comments

Projects

None yet

1 participant

@McManning

Hi all,

When working with Propel, I've ran into the following issue:

I have a data model that uses an object as a master (primary entry point) and multiple objects linked to that in either one-to-one or one-to-many relationships. My goal was to replicate the master as a new record, which should also simultaneously replicate the related objects. Via deep copy, this works fine for one-to-many relationships. However, not for one-to-one.

When performing a deep copy on a one-to-one relationship, it looks like rather than the two new objects referencing one-another after being created, a third entry is added which the second object references, rather than the desired first object.

In terms of the Bookstore test case; if I had a BookstoreEmployee and BookstoreEmployeeAccount and did a deep copy on BookstoreEmployee, it would create two new BookstoreEmployee entries, the first of which being our desired copy, and the second being an additional copy that the new BookstoreEmployeeAccount is referencing instead of the desired copy.

https://gist.github.com/McManning/8056822

I've added a gist of my test case for this. I won't rule out an issue with my implementation, but this doesn't seem like expected behavior.

Thanks,
Chase

@McManning McManning added a commit to McManning/Propel that referenced this issue Feb 25, 2014
@McManning McManning Adding unit test for one-to-one relationship deep copy bug (Propel Is…
…sue #806)
9380ca2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment