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
Fixed a situation where unnecessary sql UPDATE statements were issued fo... #814
Conversation
… for unchanged DateTime objects
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-2725 We use Jira to track the state of pull requests and the versions they got |
sorry for closing eagerly. Again, doctrine won't support hardcoded custom checks. see http://stackoverflow.com/questions/15486402/doctrine2-orm-does-not-save-changes-to-a-datetime-field/15488230#15488230 You will need for support of value objects to see this happening. |
Well, Doctrine clearly shows wrong behaviour. It's executing an update statement when no update statement is required. Thanks for the link. It describes yet another issue, related to the same line of code, but is not exactly the same, as what I was talking about. |
The idea is to have comparators (just an idea so far) do the work. So far we didn't introduce them because they only solve edge cases and cause great performance overhead. I was working on something in my ChangeSet project, but it's currently on hold. |
Great performance overhead is generating redundant UPDATE queries which, obviously, take some time to execute. |
Yes, but we can't fix it without a massive amount of overhead for the 99% use-case scenario. |
Ok, of course, it's up to you to make strategic decisions, but it could be solved without any massive overhead. 1 |
Yes, but that's just fixing a symptom that comes from the
mutability/immutability dichotomy in column types. We don't have a
performance-valid solution for that, and adding exceptions and edge case
handling just clutters the code and introduces more bugs.
If you want to improve this then I suggest looking into a way of unifying
hydration and changeset computation with DBAL type awareness baked in.
Hacks for edge cases are not allowed in any of the doctrine projects,
unless it's about security issues.
…On 3 Aug 2017 11:33 PM, "AlexeyKosov" ***@***.***> wrote:
Ok, of course, it's up to you to make strategic decisions, but it could be
solved without any massive overhead. 1 if condition for checking if the
comparable items are both objects and have the same type and another 1 to
check if there's a comparator (or however you call it) registered for that
class. In other words, it could be implemented as an optional feature, i.e.
if one wanted to enable it for, say, DateTime or Money objects, they
could inject a comparator for the specific class which would be responsible
for comparing objects of this type. All other comparisons could still be
done using ===.
IMHO, a couple of simple checks are much less evil than executing tons of
unnecessary update queries.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#814 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJakDIMolXZhiUUSLB2IAiLErrToy1Rks5sUjy6gaJpZM4BEaIw>
.
|
Your point makes sense and, indeed, the ideal solution would be comparing the values in the form they go to the database, rather than objects.
Currently, I have to wrap all setters with something like this:
Obviously, looks like a dirty hack. It's great that you managed to avoid such hacks in Doctrine itself, and hopefully, at some point you'll manage to allow Doctrine's users get rid of those in application business-logic. |
@AlexeyKosov this issue can't be solved - just because |
...r unchanged DateTime objects
computeChangeSet method in unitOfWork compares original and new data using 'identical' (===) operator. This works well, except for DateTime objects.
Two different DateTime objects that contain the same data, should not trigger an unnecessary UPDATE query.
I made changes to account for this case.