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...
See https://www.drupal.org/core/d8-bc-policy

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.

Comments

thalles created an issue. See original summary.

thalles’s picture

gausarts’s picture

Status: Needs review » Needs work

Feel free to commit this after the change mentioned here and there. Thanks a lot!

gausarts’s picture

Assigned: thalles » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.51 KB

Let's see if any issue.

  • gausarts committed 0da512b on 8.x-2.x authored by thalles
    Issue #3113227 by thalles, gausarts: Fix subclassing and stop overriding...
gausarts’s picture

Status: Needs review » Fixed

Let's get the ball rolling, we have another release to catch up. Any (side) issue and or improvements may follow as always.

Committed. Thank you for contribution!

thalles’s picture

Thanks @gausarts!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.