Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Add object that uses the FactoryInterface should have dependencies inject via ::create and not ::__construct(). This allows parent classes to change their constructor without breaking any code.
@see https://events.drupal.org/seattle2019/sessions/drupal-9-coming-getting-y...
Example: \Drupal\config_sync\Controller\ConfigSyncController::create
@see https://www.youtube.com/watch?time_continue=1554&v=hN9KjaBvAUk
@see https://www.previousnext.com.au/blog/safely-extending-drupal-8-plugin-cl...
Proposed resolution
Fix subclassing and stop overriding constructors.
Comment | File | Size | Author |
---|---|---|---|
#2 | advagg-Fix_subclassing_and_stop_overriding_constructors_in_advagg_ext_minify_Form_SettingsForm-3107169-2-D8.patch | 1.1 KB | thalles |
|
Comments
Comment #2
thallesFollow a patch!
Comment #3
thalles