Extending "ActionBase" prohibits dependency injection because of "final" __construct() method

Created on 28 January 2025, about 1 month ago

Problem/Motivation

Extending the ECA "ActionBase" class prohibits dependency injection because of the "final" __construct() method. Does this have a reason? I tried to extend this class and its "__construct" method, but since it's set "final", I can't. Is there a reason for this?

Steps to reproduce

Proposed resolution

Remove the "final" key from the "ActionBase" "__construct()" method.

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

2.1

Component

Code

Created by

🇩🇪Germany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Grevil
  • 🇩🇪Germany jurgenhaas Gottmadingen

    That's deliberate because this way we can ensure that extending classes always remain compatible even if we change the constructor of the base class.

    You can still extend, though. You can look into all the action plugins in ECA that extend the base class with a static create function only. The call the parent create function and then set the additional properties (i.e. dependency injections) that they need.

  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks @jurgenhaas sorry we both had "final class" in our mind, no idea why :D Funny.

    Totally makes sense!

  • 🇩🇪Germany Grevil

    Totally makes sense. Should have looked into other classes first! Thanks!

Production build 0.71.5 2024