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

Add upgrade note for #1190 #1196

Merged
merged 1 commit into from
Nov 14, 2020
Merged

Conversation

phansys
Copy link
Member

@phansys phansys commented Nov 9, 2020

Subject

Add missing upgrade note for #1190.

I am targeting this branch, because this change does not affect BC.

Related to #1190.

I'm not adding a changelog about this change since the related PR is not present in any release yet.

@phansys phansys marked this pull request as ready for review November 9, 2020 12:12
@phansys phansys requested a review from a team November 9, 2020 12:12
VincentLanglet
VincentLanglet previously approved these changes Nov 9, 2020
@VincentLanglet VincentLanglet requested a review from a team November 9, 2020 13:02
@franmomu
Copy link
Member

I thought the UPGRADE-x.md file was meant to add things a user has to do in order to upgrade to version x, I see this more in the changelog of the original PR.

@phansys
Copy link
Member Author

phansys commented Nov 11, 2020

I understand your point @franmomu.
My concern is about the change in the behavior for cases where an instance of \DateTimeImmutable is already passed in projects using previous versions.
By instance, the time manipulation done at AbstractDateFilter::filter() was not affecting the passed value if it was an instance of \DateTimeImmutable, but now it does:

// date filter should filter records for the whole days
if (false === $this->time && ($value['value']['end'] instanceof \DateTime || $value['value']['end'] instanceof \DateTimeImmutable)) {
// since the received `\DateTime` object uses the model timezone to represent
// the value submitted by the view (which can use a different timezone) and this
// value is intended to contain a time in the begining of a date (IE, if the model
// object is configured to use UTC timezone, the view object "2020-11-07 00:00:00.0-03:00"
// is transformed to "2020-11-07 03:00:00.0+00:00" in the model object), we increment
// the time part by adding "23:59:59" in order to cover the whole end date and get proper
// results from queries like "o.created_at <= :date_end".
$value['value']['end'] = $value['value']['end']->modify('+23 hours 59 minutes 59 seconds');
}

@franmomu
Copy link
Member

Ah, that makes sense! but should the upgrade note reflect these changes? otherwise looks like just support was added (it is what happened to me).

@VincentLanglet
Copy link
Member

We should be more clear about what we should put to the UPGRADE note.
Same issue here sonata-project/SonataAdminBundle#6585

If we add new feature to upgrade note, adding them to the changelog seems useless.

To me, we should just add to the upgrade note things that will need change from the developer like deprecations (or mandatory BC-break)
Bug fix and new feature shouldn't be added.

@phansys
Copy link
Member Author

phansys commented Nov 11, 2020

Personally, I see the upgrade document as the first place where I should go to check if something related to a package stopped to work or if some previous behavior seems to be changed. If I can't find something related there, I check the changelog.

Ah, that makes sense! but should the upgrade note reflect these changes?

I agree, I'll try to update the message today.

@VincentLanglet
Copy link
Member

VincentLanglet commented Nov 11, 2020

Personally, I see the upgrade document as the first place where I should go to check if something related to a package stopped to work or if some previous behavior seems to be changed.

If something need to be added to the upgrade document, there should always be with a "HOW-TO" then.

@phansys
Copy link
Member Author

phansys commented Nov 11, 2020

If something need to be added to the upgrade document, there should always be with a "HOW-TO" then.

Should we take the following premise as part of the "HOW-TO" you're proposing?

If you are using these filters with instances of \DateTimeImmutable, be aware of this change in order to determine if you must update your implementation.

@VincentLanglet
Copy link
Member

VincentLanglet commented Nov 11, 2020

If something need to be added to the upgrade document, there should always be with a "HOW-TO" then.

Should we take the following premise as part of the "HOW-TO" you're proposing?

If you are using these filters with instances of \DateTimeImmutable, be aware of this change in order to determine if you must update your implementation.

I would say yes.

But in this case, I don't understand you because \DateTimeImmutable wasn't supported yet.
So why someone would use it with \DateTimeImmutable.

@phansys
Copy link
Member Author

phansys commented Nov 12, 2020

But in this case, I don't understand you because \DateTimeImmutable wasn't supported yet.
So why someone would use it with \DateTimeImmutable.

I'd say that they were already supported (the filter doesn't have any check forbidding the type), but not in a fully or a proper way (they weren't receiving the same treatment as \DateTime instances).
That's why I consider this as a MINOR instead of PATCH, but we could discuss about this point.

@VincentLanglet
Copy link
Member

I'd say that they were already supported (the filter doesn't have any check forbidding the type), but not in a fully or a proper way (they weren't receiving the same treatment as \DateTime instances).
That's why I consider this as a MINOR instead of PATCH, but we could discuss about this point.

Ok.

@phansys
Copy link
Member Author

phansys commented Nov 12, 2020

Ah, that makes sense! but should the upgrade note reflect these changes? otherwise looks like just support was added (it is what happened to me).

The note was updated @franmomu 👍

VincentLanglet
VincentLanglet previously approved these changes Nov 12, 2020
franmomu
franmomu previously approved these changes Nov 13, 2020
@VincentLanglet
Copy link
Member

You may need to rebase

@OskarStark
Copy link
Member

@franmomu please give us a final review here, thanks

@franmomu franmomu merged commit e8dde94 into sonata-project:3.x Nov 14, 2020
@franmomu
Copy link
Member

Thanks @phansys!

@phansys phansys deleted the date_range_immutable branch November 14, 2020 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants