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

Backport ImageProviderInterface from 4.x #2271

Merged
merged 1 commit into from
Feb 12, 2022

Conversation

jorrit
Copy link
Contributor

@jorrit jorrit commented Jan 25, 2022

Subject

I am preparing to migrate to Symfony 5 and all new Sonata bundle, including Media Bundle 4. One issue is that I have a class that inherits from ImageProvider. This is no longer possible in 4.0, where a new interface ImageProviderInterface is introduced. It would be convenient if I could migrate my implementation to this new interface before migrating every Sonata/Symfony package.

I am targeting this branch, because it backports a feature from 4.0.

Changelog

### Added
- Added `ImageProviderInterface` so `ImageProvider` can be replaced without extending the class.

*/
private $imageProvider;

public function __construct(ImagineInterface $imagineAdapter, ImageProvider $imageProvider)
public function __construct(ImagineInterface $imagineAdapter, ImageProviderInterface $imageProvider)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure but this change looks like BC break to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can only think of one situation, namely when someone extends the validator and its constructor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wouldn't it be BC @jordisala1991 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also remove the explicit parameter type and check it at runtime.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is BC, fine by me :)

@VincentLanglet
Copy link
Member

If it's okay for you @jordisala1991 we'll merge this

@VincentLanglet VincentLanglet merged commit c49ba3d into sonata-project:3.x Feb 12, 2022
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.

None yet

4 participants