-
Notifications
You must be signed in to change notification settings - Fork 519
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
Allow to decorate the UploaderHelper #1288
Conversation
I don't think we'll need that in the next major version. |
I have to correct myself: UploaderHelper can be directly used, indeed. Anyway, I think that we can delay the move of adding a new interface to the next major version. |
Why should we delay this ? Adding the interface in the 1.x version, allows people to solve deprecation/message about the fact the UploaderHelper is final. Currently I have two solutions
With the interface I could use decoration, solve my issue and update the library. It seems better to give a migration path rather than having to solve all the BC break in the next major. |
The problem is that we would change the signature of the UploaderExtension constructor, and this can break if a user extended it. |
Changing Prior to this, if you pass UploaderHelper to the constructor it will still works. |
That's a good point. |
Tests are fixed. |
@garak I tried to add some deprecations. Tell me if it's ok for you. |
@@ -41,6 +41,16 @@ public function getFunctions(): array | |||
*/ | |||
public function asset($object, ?string $fieldName = null, ?string $className = null): ?string | |||
{ | |||
if (!\is_object($object)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already deprecated in the helper. If we keep it here too, user will get a duplicate deprecation warning, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only if you don't use a custom UploaderHelper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to avoid duplicate deprecation, I can add a check !$this->uploaderHelper instanceof UploadHelper
.
WDYT ?
@garak I avoid the duplicate deprecations now |
Thank you @VincentLanglet |
You're welcome ; do you have time for a release ? :) |
As soon as we sort up #1273 |
Hi @garak.
I recently tried the 1.19 version and got an issue.
Since the UploaderHelper is/will be final, I cannot extends it.
But since this class is required (and not an interface) in the construct of the UploaderExtension, I cannot use decoration either.
This PR solve this issue.