Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add inheritance support for fixtures with many to many relationship #256

Merged
merged 4 commits into from Jan 7, 2014

Conversation

Projects
None yet
3 participants
Contributor

pimpreneil commented Nov 28, 2013

In propel fixtures, when using many to many relationship on a child object (when using a propel inheritance behaviour), an error gets triggered because it cannot find the relation between the object and one of its parents relation.

The error is:

PHP Fatal error:  Method name must be a string in /home/arnaud/www/primo/vendor/propel/propel-bundle/Propel/PropelBundle/DataFixtures/Loader/AbstractDataLoader.php on line 306

Here is a concrete use case (that triggers the error above):
Let's assume that the CampaignSystem class inherits from the Campaign class, and that the Campaign class is linked with a many to many relationship to the locale class through the crossRef CampaignLocale class.

The fixtures would look like this:

Locale:
    locale_en_us:
        locale: 'en_US'
    locale_en_gb:
        locale: 'fr_FR'

CampaignSystem:
    campaign_1:
        campaign_locales: [locale_en_us, locale_fr_FR]

So to sum the things up, the issue is that it is impossible for a child object to use its parents relationship.

The attached pull request fixes this issue.

Owner

willdurand commented Nov 28, 2013

tests?

Contributor

pimpreneil commented Nov 29, 2013

In addition of the tests of the inheritance bug, I have added a small fix for the inheritance feeding that did not work when the linked class was also a child object.
Even if the second fix is very small, I will still try to write some tests for it asap...

Contributor

pimpreneil commented Jan 4, 2014

Done with the commits, do you think it is mergeable as is or do you have any comments about it?

Owner

willdurand commented Jan 4, 2014

I guess it is ok. @havvg wdyt?

Member

havvg commented Jan 7, 2014

Looks good to me.

Thanks!

@havvg havvg added a commit that referenced this pull request Jan 7, 2014

@havvg havvg Merge pull request #256 from pimpreneil/1.2
Add inheritance support for fixtures with many to many relationship
2e54427

@havvg havvg merged commit 2e54427 into propelorm:1.2 Jan 7, 2014

1 check passed

default The Travis CI build passed
Details

@havvg havvg added a commit that referenced this pull request Jan 7, 2014

@havvg havvg Merge pull request #256 from pimpreneil/1.2
Add inheritance support for fixtures with many to many relationship
8d60937

@pimpreneil pimpreneil deleted the unknown repository branch Jan 7, 2014

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