Closed mbabker closed 6 years ago
@wilsonge We need to find a way to do this. It needs to be possible to somehow use/inherit from Symfony\Component\Console\Application
for our root console application class, and interfaces to "bridge" things is the only practical way to do it. In effect this should help us to directly use/extend Symfony\Component\Console\Command\Command
for our command classes instead of requiring our own root class/interface as well.
LGTM. We should make the CMSApplicationInterface extend out of this when we merge into j4
When implementing the
joomla/console
package, there are two pain points in the package's design:Symfony\Component\Console\Application
(which basically mandates we have to have our own base Application and Command classes with no ability to use the upstream classes or anything that might be compatible withsymfony/console
)joomla/input
intoSymfony\Component\Console\Input\InputInterface
which in effect means there are two copies of the input data floating around (one insideJoomla\Input\Cli
which isn't really kept in sync and theJoomla\Console\Input\JoomlaInput
class which is a subclass ofSymfony\Component\Console\Input\ArgvInput
and is really the main input data source in this context)This PR addresses one of those pain points, being impossible to subclass the Symfony application class. To do that, we need an interface for our own application and what capabilities need to be provided. So, 2 interfaces are introduced: one for the main application's basic capability (execute it) and one for an application which is aware of your local configuration (if one even exists, assuming you can build a config-less system). The
AbstractApplication
implements the newConfigurationAwareApplicationInterface
which satisfies all requirements, and lays the groundwork for being able to define root application capabilities (this is the closest thing we have a kernel in relation to other frameworks anyway) without requiring everything to extend a base class.