Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h4cc_alice_fixtures.manager not honouring mapping configuration #20

Closed
garciall opened this issue Aug 19, 2014 · 9 comments
Closed

h4cc_alice_fixtures.manager not honouring mapping configuration #20

garciall opened this issue Aug 19, 2014 · 9 comments
Assignees

Comments

@garciall
Copy link

When I try to persist some fixtures using:

$manager = $client->getContainer()->get('h4cc_alice_fixtures.manager');
static::$fixtures = $manager->loadFiles(array(__DIR__ . '/../DataFixtures/product.yml',__DIR__ . '/../DataFixtures/itemProduct.yml'));
$manager->persist(static::$fixtures);

It fails with:

Doctrine\Common\Persistence\Mapping\MappingException: The class 'xxx\yyyBundle\Entity\Item' was not found in the chain configured namespaces

Because is not honouring the config.yml mapping configuration when you have multiple entity managers.

I think this is a good read on that:
http://php-and-symfony.matthiasnoback.nl/2014/05/inject-the-manager-registry-instead-of-the-entity-manager/

@h4cc h4cc self-assigned this Aug 23, 2014
@h4cc
Copy link
Owner

h4cc commented Aug 23, 2014

Thanks for that hint, will get on it.

@garciall
Copy link
Author

@h4cc I tried to fix it somehow but I'm quite new to Symfony and lack the
knowledge, feel free to have a look at my forked repo which at least works
for my needs.

h4cc added a commit that referenced this issue Aug 24, 2014
… in #20.

Removed the the simple configureable object_manager value.
SchemaTools will now drop and recreate the schemas from _all_ configured enitity managers.
@h4cc
Copy link
Owner

h4cc commented Aug 24, 2014

@garciall have a look at the feature branch.

@h4cc
Copy link
Owner

h4cc commented Aug 30, 2014

@garciall Does it work? You can tes the branch using this composer requirement:

"h4cc/alice-fixtures-bundle": "dev-feature/doctrine-manager-registry"

@garciall
Copy link
Author

@h4cc I tried this yesterday and it works smoothly!

I just found another issue, I have some fixtures which are related using a join table which uses associationKey for its primary key. Imagine having Item <> ItemProduct <> Product. If I try to load all the fixtures at the same time, i.e. Item, Product and then ItemProduct it fails on the last cause it lacks an autogenerated id for the first two, is there any way to force a flush between fixtures loading?

@h4cc
Copy link
Owner

h4cc commented Aug 30, 2014

You could seperate it into two sets, there will be a flush after each one.

@garciall
Copy link
Author

Ok! I'll try that 👍

@h4cc
Copy link
Owner

h4cc commented Aug 30, 2014

Thank you for testing, will prepare this for a v0.4 release.

h4cc added a commit that referenced this issue Aug 31, 2014
… in #20.

Removed the the simple configureable object_manager value.
SchemaTools will now drop and recreate the schemas from _all_ configured enitity managers.
@h4cc
Copy link
Owner

h4cc commented Sep 8, 2014

@h4cc h4cc closed this as completed Sep 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants