Skip to content

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