allow self reference in DataLoader #114

Merged
merged 1 commit into from Mar 5, 2012

Conversation

Projects
None yet
2 participants
Member

havvg commented Mar 2, 2012

This allows to reference on previous entries of the same model, thus issuing on UPDATE rather than an INSERT on the object. This is helpful, if you need to load fixtures with VersionableBehavior attached and loading multiple versions.

An example YAML fixtures file:

Acme\Bundle\BlogBundle\Model\Post:
    Post:
        name: "A very interesting one"
        content: "Content with a typoe."
        version: 1
        version_created: 2012-02-29 12:03:23

    Post_V2:
        id: Post
        name: "A very interesting one"
        content: "Content without the typo."
        version: 2
        version_created: 2012-02-29 12:07:12

This would create one Post entry, but with two PostVersion of it.

Owner

willdurand commented Mar 3, 2012

👍

But, define a convention for that, and some constraints for that. I don't want to deal with issues due to this feature.
We probably need to define some conventions for each behaviors, and to determine common rules.

allow self reference in DataLoader
A self referencing entry will trigger an "UPDATE" rather than another "INSERT" with the new data.
Member

havvg commented Mar 5, 2012

@willdurand Test added, good to go, imho. - Rebased onto previous changes of DataFixtures.

Owner

willdurand commented Mar 5, 2012

Ok, good to merge ;)
By the way, can you improve the doc? (the propelorm.org one for instance)

willdurand added a commit that referenced this pull request Mar 5, 2012

@willdurand willdurand merged commit 49598d1 into propelorm:master Mar 5, 2012

@havvg havvg referenced this pull request in propelorm/propelorm.github.com Mar 6, 2012

Merged

documentation for self referencing data loader #100

@havvg havvg deleted the havvg:feature/dataloader-self-reference branch Dec 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment