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

[DoctrineWriter] Return entity after writeItem() method call #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fsevestre
Copy link

#271

This PR add the return of the entity after calling the writeItem() method on DoctrineWriter.

@Baachi
Copy link
Collaborator

Baachi commented Oct 7, 2015

Whats the usecase of this? I can't merge this PR without any good reason.

@Baachi
Copy link
Collaborator

Baachi commented Oct 7, 2015

Ah nevermind, i don't see the linked issue 🙈

I think you don't use the workflow in the right way. What you want is to persist an collection, this should be handled in the writer itself.

@fsevestre
Copy link
Author

Sorry, I don't figure out how to manage it in your way :s

To be more specific on my use case:
I'm calling an API which return a tree and his nodes and I want to import it on my own database.

Each nodes (and for the fun, with inheritance) have a tree and a parentNode properties.

I would like to be able to flush all my entities at the same time (I have event subscribers at the insertion of a new tree and a new node).

Thanks for your time

@Baachi
Copy link
Collaborator

Baachi commented Oct 7, 2015

Interesting use case 👍

I would say you should use a item converter which converts your api response to an object (for example your entity).
This converter should convert your tree node, too.

Register the DoctrineWriter and let them persist each node. You don't have to care about persist the relationip. Doctrine will do it for you.

One hint: If you import a large dataset, don't use doctrine at all, use raw SQL. Doctrine will consume a huge memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants