-
Notifications
You must be signed in to change notification settings - Fork 15
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
flush in save() method should be limited to just that entity #12
Comments
Hi @tacman , Can you explain your use case to have history about that please? |
We're using the bundle to create a list of links during our testing, and in the process of doing that we're creating entities that we don't want persisted. Alas, some of those entities are tagged in Doctrine as having automatic persistence, which isn't a big deal, since we simply don't flush the entity manager at the end. So the problem now is that if we use the bundle to create a short URL, it's calling flush() and saving those entities to the database. We want the link flushed, but nothing else. |
Alternatively, we could pass $flush to the methods that call ->save(),
which currently always call it with true. $flush could be passed to
shorten() and propogated.
…On Thu, Nov 2, 2017 at 7:11 AM, Rémi Marseille ***@***.***> wrote:
Hi @tacman <https://github.com/tacman> ,
Can you explain your use case to have history about that please?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAl0QTp7I91nADu_Q_l8dpRRkmjFCowpks5syaNYgaJpZM4QPdk6>
.
|
I think it will be more logical to flush only the given entity instead of adding a |
Agreed. The only downside is that flush shouldn't be inside a loop, but that's an edge case. But the save method definitely should not be flushing entities outside the scope of the bundle. Is my PR okay? Alas, I'm not familiar enough with writing tests to do so. Obviously, it's a really tiny change. |
Let's go to #13 to validate the PR |
The global flush of the entity manger is unnecessary and problematic -- only the link itself should be persisted to the database. I'll add a PR for this.
The text was updated successfully, but these errors were encountered: