-
-
Notifications
You must be signed in to change notification settings - Fork 67
Rephrase ObjectManager::merge() BC break doc #251
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
Conversation
It refers to another deprecation that has been reverted.
Thanks @greg0ire! |
Sorry to say that here, but every time I read this line of the doc, I feel like I've been given a 🖕. :/ Our project uses |
For the record: Nobody says that. |
Thanks for answering without answering... For the record : the quote were not meant to imply someone said exactly that, but rather that that's how I interpreted every written sentence (in doc, issues, etc) related to the removal of this method I've ever read (and there's been some, I've been looking out for that problem for years now). Not once have I seen a comment that gave any support to the users of the library. So again, my question is : is it possible to provide such a supportive answer ? One that provide an upgrade path, in the means of code examples, some separate repository with the code, or else... ? Or is this method just impossible to migrate in any way, and every one using it have two choices : either throw their code away and close their business, or be stuck on a soon-to-be-outdated library version ? If so, I think this deprecation notice should have a bit more context and explain how everyone's using it is damned. |
It's not possible to provide a clear migration path as there's too many ways one could use merge:
That's just 3 usages from the top of my head I've seen over the years, but not the only ones. Upgrade path depends on why somebody used merge in the first place. It's just my personal opinion, but I've been using Doctrine for many years, wrote apps big and small, and never HAD to use merge. There were moments I could, it even could have been handy, but I decided not to and never looked back. |
I don't know what SLC refers to? Here's two of the most common usages in our codebase : public function save(Alert $alert)
{
if (!$alert->getId()) {
$this->em->persist($alert);
} else {
$this->em->merge($alert);
}
$this->em->flush();
return $alert;
} And sometimes, it's even : public function save(AbsenceRequest $absenceRequest)
{
$entity = $this->em->merge($absenceRequest);
$this->em->flush($entity);
return $entity;
} There are some more exotic usages too unfortunately that I can't really share as-is. |
Second Level Cache
Your first example is exactly what I had in mind with "I've even seen random calls to merge that were discarding returned object. How can we advise?". Why are you merging the object, discarding what merge told you, and returning the original from method? This is not how |
Sorry to interrupt again and not being helpful, but this is a merge request that fixed a tiny piece of documentation, not a support forum. Can we please use https://github.com/doctrine/orm/discussions for support questions (assuming that the ORM is the persitence implementation that is being used here)? |
Feel free to mention me in a discussion thread if you create one as I'm not following all ORM activity. From my perspective your demonstrated usage of |
It refers to another deprecation that has been reverted.