Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Deprecate ContainerAwareCommand #21623

Copy link
Copy link
Closed
Closed
Copy link
@chalasr

Description

@chalasr
Issue body actions
Q A
Bug report? no
Feature request? yes (proposal)
BC Break report? no
RFC? yes
Symfony version 3.x

I propose to deprecate ContainerAwareCommand, that would IMO be a great step in order to fully avoid ContainerAware stuff in final applications as well as in the core.

Motivation:

  • This class is part of the FrameworkBundle, it can live without it
  • Injecting the container is weird, as of 3.3 we have all in hands to avoid doing so
  • Same reasons that make a class better when it has explicit dependencies: it's clear what a command provides and what it doesn't, just by looking at its dependencies
  • Extending ContainerAwareCommand is almost a convention when writing commands in the full-stack framework and most often there's no strong reason behind it (or not at all): commands can just be services and explicitly declare their dependencies as any other
  • Yet creating a container aware command is an easy way to get a working command with no configuration since the container is auto injected, that is especially useful for newcomers. But what about a AutowiredCommandInterface which would be automatically registered as an autowired service instead?

Steps would be:

  • Change FrameworkBundle commands to make them services
  • Find a good replacement to get command with dependencies without config (autowiring) for newcomers and RAD
  • Deprecate the class

What do you think? I'd be glad to do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.