Baleen CLI Documentation¶
Welcome to Baleen CLI’s documentation!
Baleen CLI is a command-line wrapper that uses Symfony Console and leverages the power of Baleen Migrations. Its primary purpose is to provide out-of-the-box functionality for Baleen Migrations. But thanks to its flexible architecture it can also be used as a starting point for your own migrations library.
Warning
This program is an early release and licensed under the MIT license. Please read the LICENSE file attached to the source-code before using this program to migrate sensitive data. And of course: always back up your data before migrating.
Contents:
User’s Guide¶
Configuration¶
Then run the following command on the root directory of the project you want to migrate:
./vendor/bin/baleen init
This will create a configuration file called .baleen.yml
and a storage file at .baleen_versions
. You
should put the config file under version control, but not the storage file.
Why a storage file instead of a database table? Baleen is database-agnostic. That’s where YOU come in: you can customize Baleen CLI to use any other type of storage you can imagine. A local file is just the default we decided to ship with.
Usage¶
To see usage information and a list of available commands run ./vendor/bin/baleen
without any arguments.
Creating Migrations¶
Creating a migration is very easy, just run:
./vendor/bin/baleen create SomeOptionalTitle
A new migration file will be created inside your configured migrations folder.
Note that Baleen CLI uses PSR-4 standards for autoloading the generated migrations out of the configured migrations directory.
Advanced Baleen CLI users can overwrite the class generator to fit the needs of their project.
Adding Your Code¶
If you open a migration file you’ll see it has two empty methods: up()
and down()
, which will be called when
migrating upwards or downwards (respectively). You can put any code you want inside those methods - for example code to
transform your database, an image, a document, etc. - anything you want to migrate!
Developer’s Guide¶
Baleen CLI can perform migrations on its own, but it was also built as a framework that can help developers build their own migrations library without worrying about migrations boilerplate.
The purpose of this section is to show how developers can use the Baleen CLI framework in order to supply a migrations library for their own framework or application.
3rd Party Components¶
Baleen CLI uses a series of 3rd-party components to power its functionality. Here’s a quick overview of the main components being used and how. Throughout the rest of the guide we will assume you know how those components work, so we recommend reading up on each component’s documentation on an as-needed basis.
Main components (used directly by Baleen CLI) listed in alphabetical order. Their dependencies are not included in this list unless they’re used directly as well.
Baleen\Migrations¶
Provides the domain model for migrations. Many of the architectural concepts from that library also apply to Baleen CLI. We recommend reading up on the Baleen Migrations documentation for a better understanding of how this library works. For example, you might want to know what the “Storage” is meant to do.
League\Container¶
Allows for easy customization of almost every aspect of the framework.
League\Flysystem¶
A file-system abstraction library. Used e.g. to read/write config files.
League\Tactician¶
A simple library that implements the CommandBus pattern. More about it in the Commands section.
Symfony\Config¶
A library that facilitates creating and validating configuration schemas. More about it in the Configuration section.
Symfony\Console¶
A widely-adopted library for interacting with the command-line.
Commands¶
Service Name: Services::COMMANDS
Symfony Console’s commands are each of the actions that can be executed by an end-user of the migrations library. However we took a slightly different approach with commands than usual:
Commands vs Messages & Handlers¶
One of the things that we found annoying in other migration libraries is that almost everything had to be configured before you could even execute a basic library command in the console. For example, in some libraries you can’t even get help about available commands without first configuring your database connection - which usually doesn’t make much sense.
In order to solve that issue Baleen CLI decouples the Command definition from its execution (this might in fact be a
good feature for future SymfonyConsole versions). This decoupling is facilitated by League\Tactician
together with League\Container
to gather application dependencies ONLY once they’re actually needed. This
allows end-users to query the help for your executable without having to configure a database connection, because the
database connection will only be instantiated when its ACTUALLY needed.
Tip
All of this happens behind the scenes so you don’t have to worry about it. Refer to the BaseCommand
class for more information.
Since we’re using a CommandBus library, we decided to disambiguate the meaning of Command as follows:
- Whenever we refer to Commands we mean
Symfony\Console
commands, and we’ll mark them with bold. E.g. status, or migrate.- But whenever we refer to Messages, we refer to a “command message” from the CommandBus pattern. These messages are classes whose name ends with “Message”, e.g. “StatusMessage” or “MigrateMessage” - which correspond to the example commands on the previous item (they provide the command definition to
Symfony\Console
).
Customizing Commands¶
The list of available commands is configured and provided by CommandsProvider
, which also allows for a
flexible way to customize them:
Create your own commands provider class.
Have it extend
CommandsProvider
.Add a public constructor and use it to customize the contents of the
$commands
protected property. E.g.:/** * Example from Doctrine Migrations * __construct */ public function __construct() { // custom message and custom handler $this->commands[Services::CMD_REPOSITORY_CREATE] = [ 'message' => CreateMessage::class, 'handler' => CreateHandler::class, ]; // customize message only - use default handler $this->commands[Services::CMD_TIMELINE_EXECUTE]['message'] = ExecuteMessage::class; // custom message and custom handler $this->commands[Services::CMD_TIMELINE_MIGRATE] = [ 'message' => MigrateMessage::class, 'handler' => MigrateHandler::class, ]; BaseCommandsProvider::__construct(); }
Overwrite the default commands provider by supplying a reference to your own inside
config/providers.php
.
In other words, adding or modifying commands is as simple as extending the default CommandsProvider
and customizing
the $commands
property to point to the correct messages and handlers. The base CommandsProvider
will do the rest
of the work for you.
Comparator¶
Service Name: Services::COMPARATOR
The comparator is simply an invokable class that receives two Versions as arguments by implementing
ComparatorInterface
. The reason its a class is that we preferred to make sure we had control over the
comparator’s signature - if we had accepted closures we would have forced implementations to make many unnecessary
parameter type-checks.
When invoked, the comparator must return an integer less than, equal to, or greater than 0 (zero) in order to indicate if the first version is earlier than, equal to, or later than the second version (respectively). By earlier/later we refer to the order in which the versions should be executed.
The Comparator is used at different points in the domain logic so its useful to have it as a service.
The default Comparator used by Baleen CLI is an instance of DefaultComparator
. The service is registered by
default in the TimelineProvider
.
Configuration¶
Service Name: Services::CONFIG
The Baleen CLI framework allows you to easily define your configuration’s schema using Symfony\Config
definitions. A default schema is provided that covers the basic structure.
The default configuration schema is as follows:
<?php
[
// list of Providers to load
'providers' => [
'key' => 'My\Provider', // FQCN
// ...
],
// config for the Repository service
'migrations' => [
'directory' => '/path/to/migrations',
'namespace' => 'Migrations\Namespace', // for autoloading
],
// config for the Storage service
'storage' => [
'file' => '/path/to/storage.txt', // path to storage file
],
];
Throughout this tutorial we refer to specific configuration options using a dot (.) to indicate nesting levels. E.g. the configuration file location can be specified with the “storage.file” option.
Note
The “migrations” section in the configuration corresponds to the Repository. But we decided to name it “migrations” simply because that would be a more recognizable name for end-users who are not familiar with the nomenclature we use at Baleen.
Customizing the Configuration¶
If you’re building your own migrations library based on Baleen CLI you can easily customize the configuration definition and main configuration class to your needs. If you read any of the other guides most of the process should be familiar by now, but there are a couple of unique considerations - the main configuration file must:
- Provide default configuration values that comply with the
Definition
. - Accept a configuration that’s compliant to the Definition.
Therefore if you change the configuration class, its likely you’ll have to change the Definition, and vice-versa.
Configuration Class¶
To customize the configuration class simply create a new class that implements ConfigInterface
and adds
any additional functionality you may need. Then provide the class in the container under the key mentioned at the top of
this page.
A set of methods that’s important to mention is ConfigInterface::getDefaults
and the
Config::get{SECTION}Defaults
family of methods (e.g. Config::getProviderDefaults
). The main
getDefaults()
method should return a complete array of defaults, which is what will be used to create the end-user’s
configuration file when the user runs the config:init
command. The other methods in the family are in charge of
returning defaults for the specified section. This is not enforced by the interface, but its useful if you only want to
customize the “storage” defaults but not the rest. See the next section for further explanation.
Another method that’s important to note is ConfigInterface::getDefinition
. It must return an instance of
Symfony\Component\Config\Definition\ConfigurationInterface
.
Note
For more information about the methods declared in ConfigInterface
refer to the referenced docs.
If the changes to your configuration class don’t affect the default definition then just return the default definition. Otherwise read the next section.
Definition Class¶
The definition class is simply a class that implements Symfony\Component\Config\Definition\ConfigurationInterface
.
So if you want to start your configuration from scratch just implement that interface on a clean class.
Baleen’s configuration definition is broken down into multiple methods to make it easy to customize only certain sections of the configuration. For example, if all you need is to customize the “storage” section of the definition:
- Create a new Definition class that extends
Definition
. - Override the :php:meth:
Definition::addStorageNode
method and supply your own rules for that node. - The method must return an instance of
Symfony\Component\Config\Definition\Builder\NodeDefinition
.
The Definition class is not offered as a service. Its only accessible through the main configuration class’
ConfigInterface::getDefinition
function. So if you have to change the definition you will always have to
override the main Config class as well.
HelperSet¶
Service Name: Services::HELPERSET
The HelperSetProvider
supplies the Application
with a
Symfony\Component\Console\Helper\HelperSet
. The individual helpers are also registered as services to allow for
easier customization.
Customizing the HelperSet¶
If only the question or config helpers need to be customized then simply override their service. Otherwise its
recommended to replace the HelperSetProvider
class entirely in order to customize the HelperSet service.
Providers¶
Providers are a concept of League\Container
: they’re simple classes that tell the container about a group of
services they can provide. They only register those services in the container once at least one of those services is
actually requested from the Container. Its important to keep that in mind.
Note
For more information about how Providers work refer to the League\Container
: documentation.
Tip
Providers are central to Baleen CLI because they’re the main way services are registered into a container.
Bootstrap¶
The bootstrap.php
file is the one that handles the initialization of the Container and adds providers to it. The
sequence is as follows:
- Container is initialized with a few default services.
- The
ConfigProvider
gets registered as the first provider. This provider must provide the configuration service (named after theServices::CONFIG
constant, which we’ll refer to as the “Config service”). - The Config service is immediately fetched from the container.
- All providers supplied by the Config service are then added to the Container. At least one of them must supply the
Service::APPLICATION
service. - The Application service is fetched and the
Application::run()
method is executed.
Customizing Providers¶
Providers can be customized (added, overwritten, removed, etc.) several ways:
- Directly in the
bin/boostrap.php
file. Not recommended, unless the provider can’t be configured. - By modifying the
config/providers.php
file. This is the recommended method if you’re building your own migrations library (see the guide). - On the end-user’s configuration file, under the “providers” section (similar to #2). This just give end-users the possibility to further customize the behaviour of the migrations library if desired.
Repository¶
Service Name: Services::REPOSITORY
The repository service must either implement RepositoryInterface
directly or extend
AbstractRepository
, which provides some convenient boilerplate functionality.
The Repository Provider` must also provide the Services::REPOSITORY_FILESYSTEM
and
:php:const`Services::MIGRATION_FACTORY` services.
The default implementation for this service is DirectoryRepository
. And unless you need to load migrations
for another source other than the filesystem, or from multiple folders at a time, the default implementation should
cover the needs of most migration libraries.
Repository Filesystem¶
Service Name: Services::REPOSITORY_FILESYSTEM
This service must be a instance of League\Flysystem\FilesystemInterface
and is used both to load the migrations and
also to create them (the latter with the migrations:create command). Its root must therefore point to the folder
where those migrations will be located.
By default the repository’s folder can be customized by end-users by using the configuration option “migrations.directory”.
Migration Factory¶
Service Name: Services::MIGRATION_FACTORY
This service must implement FactoryInterface
. It’s used to instantiate all migrations that are loaded by
the repository, which is useful for example if the migration class needs certain dependencies to be injected.
The default implementation used for this service is SimpleFactory
.
Storage¶
Service Name: Services::STORAGE
The Storage service must implement StorageInterface
, and we recommend that it additionally extends
BaleenMigrationsStorageAbstractStorage
. For more information on how to implement
StorageInterface
please refer to the Baleen Migrations documentation.
The default Storage service implementation is the FileStorage
class, which saves versions into a local
file. The file’s location can be specified using the configuration option “storage.file”, and defaults to
.baleen_versions
.
Timeline¶
Service Name: Services::TIMELINE
This service provides an instance of BaleenMigrationsTimeline
and sets its Comparator. Since this
service almost exclusively relies on other services in the framework, migration libraries will hardly ever need to
replace this service.
By default a special factory is used to instantiate the Timeline. The factory is an instance of
TimelineFactory
. When instantiating a Timeline, the factory creates a collection of available migrations by
“enriching” the migrations available in the Repository service with the state data available from the
Storage service. In the process, it also makes sure that there’s no missing migration files in the Repository
(e.g. a version that is reported as migrated in the Storage but that has no corresponding file in the Repository).
In Baleen CLI the default TimelineProvider
provides also the Services::COMPARATOR
service.
Refer to the Comparator page for more information.
Tutorial: Build Your Own Migrations Library¶
This guide will provide a general overview of how you can build your own migrations library using the Baleen CLI framework.
We’ll use Doctrine Migrations as inspiration for our examples, but keep in mind that you can create a migration library for virtually anything using Baleen.
Doctrine Intro¶
Since Doctrine Migrations will be our main example for the guide, its worth mentioning some basic things about how Doctrine works and what exactly we’re set to accomplish here.
Doctrine provides applications with a flexible database abstraction layer. In other words its the interface between an application and one or more databases. Among other things, Doctrine provides an ObjectManager as one of the entry points to most of the functionality. This “entry point” is an important concept to keep in mind when building a migration library.
What’s important under the scope of this guide is that the purpose of building a migrations library for Doctrine is to provide a mechanism to ensure the database schema - and potentially some data - remains consistent across different environments.
Overview¶
During the course of this tutorial we’ll accomplish the following key goals:
- Create the skeleton for our migrations library based in Baleen CLI.
- Create a Doctrine-specific Storage service.
- Create a Doctrine-specific abstract migration class that can be extended by concrete migrations.
- Link to the application: inject the application’s ObjectManager into that Migration class.
- Customize the configuration schema to offer options to configure the Storage and other aspects of our new library.
Getting Started¶
The first step of creating your own migrations library is to copy the skeleton of Baleen CLI into a new folder. The skeleton consists of these files:
bin/baleen
: entry point for unix systems. All it does is include the bootstrap file.bin/bootstrap.php
: bootstrap script for your application.config/defaults.php
: default values for your configuration file.config/providers.php
: contains a list of providers that will be loaded during bootstrap.src/Application
: specifies you application’s name and version.
You can optionally also copy the test configuration files if you’d like to use a similar approach to testing.
Next initialize Composer (composer init
) and include the following dependencies:
baleen/cli:dev-master
doctrine/dbal
: if you’re building for another library then you’d reference that other library instead, of course.
Then rename bin/baleen
to whatever makes sense for your new migrations library, e.g. bin/migrations
-
and add a reference to it in your composer.json file:
{
"bin": {
"bin/migrations"
}
}
Finally, customize the src/Application.php
file to use the name and version of your library.
After all of this you should already be able to test your binary by executing bin/migrations
in your terminal and
see a list of available commands.
At this point you might find it interesting that if you run any of those commands they will WORK, only that the functionality provided is the default Baleen CLI functionality. That’s because we haven’t customized any of the providers, and therefore all of the providers (:file:`config/providers.php) that are being loaded by the bootstrap file are still the default Baleen CLI providers.
Creating the Doctrine Storage Service¶
By default Baleen CLI stores versions into a .baleen_versions
file. Since we want to version a database it would
make sense to store the database version in the database itself. Doing that is easy. The goal for this step is to create
a DoctrineStorage
class that implements Baleen\Migrations\Storage\AbstractStorage
and implements all missing
functions (such as doFetchAll()
, saveCollection()
, etc.).
First create a Version
entity for Doctrine. All it needs is an “id” field of the type “string”, unique and
primary-key. That field will store the id of the version that has been migrated.
Note
The resulting entity class can be found in the Doctrine Migrations repository under lib/Entity/Version
.
Then create the DoctrineStorage
class. Extend AbstractStorage
and implement the missing methods. You can use a
constructor (or setters) to inject the dependencies it will need for its methods. For example you’ll want to inject the
ObjectManager, a doctrine Repository, or possibly even both - depending on your needs. You can see a finished
DoctrineStorage class in the same Github repository linked above under lib/Storage/DoctrineStorage.php
.
Finally, all that’s left is to declare a service in the Container that will return DoctrineStorage under a predefined
service name. The predefined service name can simply be referenced using the Services::STORAGE
constant.
Since a Storage object is meant to be stateless it can be declared as a singleton. Keep in mind the service factory must
take care of injecting the Doctrine dependencies (Object Manager and/or Entity Repository) during instantiation.
To declare that service simply create a new Service Provider class and add it to the list of providers in
config/providers.php
- you can use any string as the key but “storage” is self-explanatory. You should also
remove the reference to the default storage provider.
Note
The resulting Storage Provider class can be found in the Doctrine Migrations repository under file
lib/Provider/StorageProvider
, which works together with lib/Provider/DoctrineProvider
to inject the Doctrine
dependencies.
With the DoctrineStorage
service in place would be able to use the migration commands just like you would with
vanilla Baleen CLI, only that instead of saving migrated versions in a file they will be saved to a database. It won’t
work just yet though.
Creating the Abstract Migration Class¶
Baleen Migrations provides a default migration class that all concrete migrations can extend:
Baleen\Migrations\Migration\SimpleMigration
. This simple, abstract migrations class extends
Baleen\Migrations\Migration\MigrationInterface
and also
Baleen\Migrations\Migration\Capabilities\OptionsAwareInterface
in order to provide “some” contextual information to
the concrete migration implementations. However, in the context of Doctrine Migrations, SimpleMigration
is not
enough. We want concrete migrations to be able to easily access the ObjectManager, which we need to inject during or
immediately after instantiation.
In order to make that easy, Baleen Migrations offers the ability to specify a “Migration Factory”. This special factory
must extend Baleen\Migrations\Migration\Factory\FactoryInterface
, and in Baleen CLI the factory can simply be
offered as a service named after the Services::MIGRATION_FACTORY
constant. If you read the previous
section you should already understand how to do that (hint: you’ll want to replace the “repository” provider).
Note
The resulting Doctrine-specific MigrationFactory
class can be found in the Doctrine Migrations repository at
lib/Migration/MigrationFactory
. And the provider can be found at lib/Providers/RepositoryProvider
.
As for the abstract migration class itself, which we’ll simply name AbstractMigration`, it will require Doctrine's
``ObjectManager
on the constructor and make it available to concrete migrations as a protected property.
Note
An example of the abstract migration class can also be found in the Doctrine Migrations repository at
lib/Migration/AbstractMigration
.
Linking to the Application¶
With the Storage
and AbstractMigration
classes in place and their respective services properly configured,
there’s still one more thing to do before the migration commands can be executed: we have to find a way to pick up the
application’s Object Manager and inject it to both the Storage service and the Migration Factory service. Regardless of
how we approach this, we’ll need a bit of the end-user’s help.
The way Doctrine typically does this kind of integration (that is: for its other CLI tools) is by allowing the user to
load the application’s Object Manager into a Console Helper (instance of Symfony\Component\Console\Helper\Helper
)
through a pre-defined integration file at the root of the project named cli-config.php
. For more information
about how the file can make the integration work refer to the Doctrine documentation.
So as far as we’re concerned all we need to do is check if that file exists, load it, and then add the resulting Console
Helper to our Application class. The code for that can go in the bin/boostrap.php
file or in a special provider.
In DoctrineMigrations we opted for a more comprehensive approach, and the code for this particular integration approach
can be found in lib/Providers/HelperSetProvider.php
.
An alternative to this approach would be to offer users the possibility to configure access to the database inside the
migration configuration file (the one created with the command bin/migrations init
). We would then pick up the
configuration and instantiate our own Object Manager based on it. But that approach requires more work from the end-user
(e.g. maintain two separate doctrine configuration files for the same database), so it shouldn’t be the primary way to
integrate. In Doctrine Migrations we chose to offer end-users the ability to choose freely which of the two approaches
they prefer.
Once you’re able to access to the application’s Object Manager from within the application you can make it a service in the container. Offering it as a service will make your life easier because you can then adjust the definitions of the Storage and MigrationFactory services to receive the Object Manager service during instantiation.
Note
Its worth mentioning that building a migrations tool for a generic doctrine-based project is harder than building a similar tool for an application framework (like Laravel, Wordpress or Magento, for example). The reason is that application frameworks tend to be convention-driven, which means the “entry point” to their database and their models is a well-known convention. That’s not the case with configuraton-driven frameworks (like ZF2 or Symfony for example), which they tend to be harder to integrate with because their “entry point” is not a convention and is therefore essentially unknown until it gets configured by the user.
Custom Configuration Schema¶
If you followed the previous steps you’d notice that if at this point you issue the config:init command your generated
configuration file will still have a “storage.file” option (used so the user can choose the name of the file used by
FileStorage
to store the list of migrated versions).
But we’re not using file storage anymore - we’re using Doctrine Storage - so that configuration option is obsolete. Let’s remove it.
You can easily replace the default configuration class (Config
) by simply creating a new configuration
class that extends ConfigInterface
. Then register that class in the Container (in a similar way as
indicated in previous steps) using the Services::CONFIG
constant. And finally provide the default values
for the configuration file by implementing the ConfigInterface::getDefaults
function.
You can then supply a different “definition” (refer to the :php:ns:Symfony\Config` module for more information) by
creating a new definition class and implementing the ConfigInterface::getDefinition
function so that it
returns your own definition. This custom definition would of course not include rules for the option we want to get rid
of.
Next time you run the config:init command, the default values from your Config class will be validated against the new Definition, and then written into the file.
You can see examples of a custom configuration file and definition in the Doctrine Migrations repository inside the
lib/Config
folder.
Conclusion¶
In this guide we built a doctrine-specific migrations library that can be used by developers that use Doctrine in their project. Several other Baleen CLI features were not covered, but if you understood how you can use the Container and its providers to customize Baleen to your needs then this tutorial’s ultimate goal has been accomplished, and you should be in good shape to get started on your own.
Tip
If you followed this guide please help us improve it by submitting a pull-request with any changes that you think might be useful for future readers.
Reference¶
Baleen\Cli¶
Baleen\Cli\Application¶
-
class
Application
¶ The entry point to Baleen CLI’s commands.
-
constant
VERSION
¶ Version to show in the help / usage message.
-
property
container
¶ protected Container
The LeagueContainer instance used by Baleen CLI.
-
__construct
($commands, HelperSet $helperSet)¶ Parameters: - $commands (SymfonyComponentConsoleCommandCommand[]) – Array of Commands available for the Application.
- $helperSet (HelperSet) –
-
init
($commands, HelperSet $helperSet)¶ Parameters: - $commands (SymfonyComponentConsoleCommandCommand[]) –
- $helperSet (HelperSet) –
-
constant
Baleen\Cli\BaseCommand¶
-
class
BaseCommand
¶ The base Command class used to build all the command definitions for the Application.
-
property
container
¶ protected Container
-
property
commandBus
¶ protected CommandBus
A reference to the CommandBus in charge of handling Messages.
-
property
serviceAlias
¶ protected string
-
property
serviceClass
¶ protected string
-
__construct
(ContainerInterface $container, $serviceAlias, $serviceClass)¶ Parameters: - $container (ContainerInterface) – A reference to the Application’s Container.
- $serviceAlias (string) – The key in the Container for the command that the instance of this class represents.
- $serviceClass (string) – Needed in order to run certain checks against the class before instantiating it with the container. This helps us make those checks without triggering all the other services through the Container’s DI functionality.
-
getContainer
()¶ Returns: Container
-
getCommandBus
()¶ getCommandBus.
Returns: CommandBus
-
execute
(InputInterface $input, OutputInterface $output)¶ Executes the current command by retrieving its associated Message from the Container, setting the Input and Output according to what was received as parameters, and finally passing that Message to the CommandBus for handling.
Parameters: - $input (InputInterface) – An InputInterface instance
- $output (OutputInterface) – An OutputInterface instance
Returns: int|null null or 0 if everything went fine, or an error code
-
configure
()¶ Calls the message’s static “configure” public function passing $this as argument to allow the message to configure the command.
-
property
Baleen\Cli\CommandBus¶
Baleen\Cli\CommandBus\AbstractMessage¶
-
class
AbstractMessage
¶ Class AbstractMessage.
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
configure
(Command $command)¶ Configures a console command by setting name, description, arguments, etc.
Parameters: - $command (Command) –
-
property
Baleen\Cli\CommandBus\Config¶
Baleen\Cli\CommandBus\Config\AbstractConfigMessage¶
-
class
AbstractConfigMessage
¶ Shared functionality for all configuration-related Messages.
-
property
configStorage
¶ protected ConfigStorage
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
getConfigStorage
()¶ Returns: ConfigStorage
-
setConfigStorage
(ConfigStorage $configStorage)¶ Parameters: - $configStorage (ConfigStorage) –
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
configure
(Command $command)¶ Configures a console command by setting name, description, arguments, etc.
Parameters: - $command (Command) –
-
property
Baleen\Cli\CommandBus\Config\InitHandler¶
-
class
InitHandler
¶ Handles the config:init command.
-
handle
(InitMessage $message)¶ Handle an InitMessage. Creates an end-user configuration file using default values. If the file already exists it simply exists without doing anything.
Parameters: - $message (InitMessage) –
-
Baleen\Cli\CommandBus\Config\InitMessage¶
-
class
InitMessage
¶ Message class for the config:init command.
-
property
configStorage
¶ protected ConfigStorage
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
configure
(Command $command)¶ Parameters: - $command (Command) –
-
getConfigStorage
()¶ Returns: ConfigStorage
-
setConfigStorage
(ConfigStorage $configStorage)¶ Parameters: - $configStorage (ConfigStorage) –
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
property
Baleen\Cli\CommandBus\Config\StatusHandler¶
-
class
StatusHandler
¶ Handles the config:status command.
-
property
output
¶ protected OutputInterface
-
property
message
¶ protected StatusMessage
-
handle
(StatusMessage $message)¶ Handles a StatusMessage, which prints the status of the migrations system in a developer-friendly format (inspired by “git status”).
Parameters: - $message (StatusMessage) –
-
printPendingVersion
(Version $version, $style)¶ Formats and prints a pending version with the given style.
Parameters: - $version (Version) – The Version to print.
- $style (string) – One of the STYLE_* constants.
-
getRelativePath
($from, $to)¶ Returns the relative path between two known paths.
Parameters: - $from –
- $to –
Returns: string
-
printDiff
($versions, $message, $style = self::STYLE_INFO)¶ Prints an array (group) of Versions all with the given style. If the array is empty then it prints nothing.
Parameters: - $versions (array) –
- $message (string|string[]) – Message(s) to print before the group of versions.
- $style (string) – One of the STYLE_* constants.
-
splitDiff
($diff, $comparator, Version $head)¶ Splits an array of Versions into two arrays and returns them. The first one contains all versions before the HEAD (latest migrated) Version, and the second one contains all Versions after HEAD. Head is never included in either of the arrays.
Parameters: - $diff (Version[]) – The array of Versions that should be split.
- $comparator (callable) – The comparator used to sort Versions.
- $head (Version) – The HEAD version.
Returns: array
-
property
Baleen\Cli\CommandBus\Config\StatusMessage¶
-
class
StatusMessage
¶ Message class for the config:status command.
-
property
repository
¶ protected RepositoryInterface
-
property
filesystem
¶ protected Filesystem
-
property
storage
¶ protected StorageInterface
-
property
comparator
¶ protected callable
-
property
configStorage
¶ protected ConfigStorage
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
configure
(Command $command)¶ Configures a console command by setting name, description, arguments, etc.
Parameters: - $command (Command) –
-
getRepository
()¶ Returns: RepositoryInterface
-
setRepository
(RepositoryInterface $repository)¶ Parameters: - $repository (RepositoryInterface) –
-
getFilesystem
()¶ Returns: Filesystem
-
setFilesystem
(Filesystem $filesystem)¶ Parameters: - $filesystem (Filesystem) –
-
getStorage
()¶ Returns: StorageInterface
-
setStorage
(StorageInterface $storage = null)¶ Parameters: - $storage (StorageInterface) –
-
getComparator
()¶ Returns: callable
-
setComparator
($comparator)¶ Parameters: - $comparator (callable) –
-
getConfigStorage
()¶ Returns: ConfigStorage
-
setConfigStorage
(ConfigStorage $configStorage)¶ Parameters: - $configStorage (ConfigStorage) –
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
property
Baleen\Cli\CommandBus\MessageInterface¶
-
interface
MessageInterface
¶ Interface MessageInterface.
-
configure
(Command $command)¶ Configures a console command by setting name, description, arguments, etc.
Parameters: - $command (Command) –
-
getConfig
()¶ getConfig.
Returns: ConfigInterface
-
setConfig
(ConfigInterface $config)¶ setConfig.
Parameters: - $config (ConfigInterface) –
-
getInput
()¶ getInput.
Returns: InputInterface
-
setInput
(InputInterface $input)¶ setInput.
Parameters: - $input (InputInterface) –
-
getOutput
()¶ getOutput.
Returns: OutputInterface
-
setOutput
(OutputInterface $output)¶ setOutput.
Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ getCliCommand.
Returns: Command
-
setCliCommand
(Command $command)¶ setCliCommand.
Parameters: - $command (Command) –
-
Baleen\Cli\CommandBus\Repository¶
Baleen\Cli\CommandBus\Repository\AbstractRepositoryListHandler¶
-
class
AbstractRepositoryListHandler
¶ Class AbstractRepositoryListHandler.
-
outputVersions
(LinkedVersions $versions, OutputInterface $output)¶ Parameters: - $versions (LinkedVersions) –
- $output (OutputInterface) –
-
getCollection
(RepositoryInterface $repository, $comparator = null)¶ getCollection.
Parameters: - $repository (RepositoryInterface) –
- $comparator –
Returns: LinkedVersions
-
Baleen\Cli\CommandBus\Repository\AbstractRepositoryMessage¶
-
class
AbstractRepositoryMessage
¶ Class AbstractRepositoryMessage.
-
property
repository
¶ protected RepositoryInterface
-
property
filesystem
¶ protected Filesystem
-
property
comparator
¶ protected callable
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
getRepository
()¶ Returns: RepositoryInterface
-
setRepository
(RepositoryInterface $repository)¶ Parameters: - $repository (RepositoryInterface) –
-
getFilesystem
()¶ Returns: Filesystem
-
setFilesystem
(Filesystem $filesystem)¶ Parameters: - $filesystem (Filesystem) –
-
getComparator
()¶ Returns: callable
-
setComparator
($comparator)¶ Parameters: - $comparator (callable) –
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
configure
(Command $command)¶ Configures a console command by setting name, description, arguments, etc.
Parameters: - $command (Command) –
-
property
Baleen\Cli\CommandBus\Repository\CreateHandler¶
-
class
CreateHandler
¶ Class CreateHandler.
-
handle
(CreateMessage $command)¶ handle.
Parameters: - $command (CreateMessage) –
Returns: false|string
-
generate
($className, $namespace = null)¶ Parameters: - $className (string) –
- $namespace (string) –
Returns: ClassGenerator
-
writeClass
(ClassGenerator $class, Filesystem $filesystem, $destinationDir)¶ Function writeClass.
Parameters: - $class (ClassGenerator) –
- $filesystem (Filesystem) –
- $destinationDir –
Returns: string|false
-
Baleen\Cli\CommandBus\Repository\CreateMessage¶
-
class
CreateMessage
¶ Class CreateMessage.
-
property
repository
¶ protected RepositoryInterface
-
property
filesystem
¶ protected Filesystem
-
property
comparator
¶ protected callable
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
configure
(Command $command)¶ Parameters: - $command (Command) –
-
getRepository
()¶ Returns: RepositoryInterface
-
setRepository
(RepositoryInterface $repository)¶ Parameters: - $repository (RepositoryInterface) –
-
getFilesystem
()¶ Returns: Filesystem
-
setFilesystem
(Filesystem $filesystem)¶ Parameters: - $filesystem (Filesystem) –
-
getComparator
()¶ Returns: callable
-
setComparator
($comparator)¶ Parameters: - $comparator (callable) –
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
property
Baleen\Cli\CommandBus\Repository\LatestHandler¶
-
class
LatestHandler
¶ Class LatestHandler.
-
handle
(LatestMessage $command)¶ handle.
Parameters: - $command (LatestMessage) –
-
outputVersions
(LinkedVersions $versions, OutputInterface $output)¶ Parameters: - $versions (LinkedVersions) –
- $output (OutputInterface) –
-
getCollection
(RepositoryInterface $repository, $comparator = null)¶ getCollection.
Parameters: - $repository (RepositoryInterface) –
- $comparator –
Returns: LinkedVersions
-
Baleen\Cli\CommandBus\Repository\LatestMessage¶
-
class
LatestMessage
¶ Class ListMessage.
-
property
repository
¶ protected RepositoryInterface
-
property
filesystem
¶ protected Filesystem
-
property
comparator
¶ protected callable
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
configure
(Command $command)¶ configure.
Parameters: - $command (Command) –
-
getRepository
()¶ Returns: RepositoryInterface
-
setRepository
(RepositoryInterface $repository)¶ Parameters: - $repository (RepositoryInterface) –
-
getFilesystem
()¶ Returns: Filesystem
-
setFilesystem
(Filesystem $filesystem)¶ Parameters: - $filesystem (Filesystem) –
-
getComparator
()¶ Returns: callable
-
setComparator
($comparator)¶ Parameters: - $comparator (callable) –
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
property
Baleen\Cli\CommandBus\Repository\ListHandler¶
-
class
ListHandler
¶ Class ListHandler.
-
handle
(ListMessage $command)¶ handle.
Parameters: - $command (ListMessage) –
-
outputVersions
(LinkedVersions $versions, OutputInterface $output)¶ Parameters: - $versions (LinkedVersions) –
- $output (OutputInterface) –
-
getCollection
(RepositoryInterface $repository, $comparator = null)¶ getCollection.
Parameters: - $repository (RepositoryInterface) –
- $comparator –
Returns: LinkedVersions
-
Baleen\Cli\CommandBus\Repository\ListMessage¶
-
class
ListMessage
¶ Class ListMessage.
-
property
repository
¶ protected RepositoryInterface
-
property
filesystem
¶ protected Filesystem
-
property
comparator
¶ protected callable
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
configure
(Command $command)¶ configure.
Parameters: - $command (Command) –
-
getRepository
()¶ Returns: RepositoryInterface
-
setRepository
(RepositoryInterface $repository)¶ Parameters: - $repository (RepositoryInterface) –
-
getFilesystem
()¶ Returns: Filesystem
-
setFilesystem
(Filesystem $filesystem)¶ Parameters: - $filesystem (Filesystem) –
-
getComparator
()¶ Returns: callable
-
setComparator
($comparator)¶ Parameters: - $comparator (callable) –
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
property
Baleen\Cli\CommandBus\Storage¶
Baleen\Cli\CommandBus\Storage\AbstractStorageMessage¶
-
class
AbstractStorageMessage
¶ Class AbstractStorageMessage.
-
property
storage
¶ protected StorageInterface
-
property
comparator
¶ protected callable
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
getStorage
()¶ Returns: StorageInterface
-
setStorage
(StorageInterface $storage = null)¶ Parameters: - $storage (StorageInterface) –
-
getComparator
()¶ Returns: callable
-
setComparator
($comparator)¶ Parameters: - $comparator (callable) –
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
configure
(Command $command)¶ Configures a console command by setting name, description, arguments, etc.
Parameters: - $command (Command) –
-
property
Baleen\Cli\CommandBus\Storage\LatestHandler¶
-
class
LatestHandler
¶ Class LatestHandler.
-
handle
(LatestMessage $command)¶ handle.
Parameters: - $command (LatestMessage) –
-
Baleen\Cli\CommandBus\Storage\LatestMessage¶
-
class
LatestMessage
¶ Class ListMessage.
-
property
storage
¶ protected StorageInterface
-
property
comparator
¶ protected callable
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
configure
(Command $command)¶ Parameters: - $command (Command) –
-
getStorage
()¶ Returns: StorageInterface
-
setStorage
(StorageInterface $storage = null)¶ Parameters: - $storage (StorageInterface) –
-
getComparator
()¶ Returns: callable
-
setComparator
($comparator)¶ Parameters: - $comparator (callable) –
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
property
Baleen\Cli\CommandBus\Timeline¶
Baleen\Cli\CommandBus\Timeline\AbstractTimelineCommand¶
-
class
AbstractTimelineCommand
¶ Class AbstractTimelineCommand.
-
property
storage
¶ protected StorageInterface
-
property
timeline
¶ protected Timeline
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
configure
(Command $command)¶ Parameters: - $command (Command) –
-
getStorage
()¶ Returns: StorageInterface
-
setStorage
(StorageInterface $storage = null)¶ Parameters: - $storage (StorageInterface) –
-
getTimeline
()¶ Returns: Timeline
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
property
Baleen\Cli\CommandBus\Timeline\ExecuteHandler¶
-
class
ExecuteHandler
¶ Class ExecuteHandler.
-
handle
(ExecuteMessage $command)¶ Parameters: - $command (ExecuteMessage) –
-
Baleen\Cli\CommandBus\Timeline\ExecuteMessage¶
-
class
ExecuteMessage
¶ Class ExecuteMessage.
-
property
storage
¶ protected StorageInterface
-
property
timeline
¶ protected Timeline
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
configure
(Command $command)¶ Parameters: - $command (Command) –
-
getStorage
()¶ Returns: StorageInterface
-
setStorage
(StorageInterface $storage = null)¶ Parameters: - $storage (StorageInterface) –
-
getTimeline
()¶ Returns: Timeline
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
property
Baleen\Cli\CommandBus\Timeline\MigrateHandler¶
-
class
MigrateHandler
¶ Class MigrateHandler.
-
property
progress
¶ protected ProgressBar
-
property
saveChanges
¶ protected bool
-
property
strategies
¶ protected array
-
property
trackProgress
¶ protected bool
-
property
output
¶ protected OutputInterface
-
property
command
¶ protected MigrateMessage
-
handle
(MigrateMessage $command)¶ handle.
Parameters: - $command (MigrateMessage) –
-
attachEvents
(OutputInterface $output, EventDispatcherInterface $dispatcher)¶ Parameters: - $output (OutputInterface) –
- $dispatcher (EventDispatcherInterface) –
-
saveVersionListener
(MigrationEvent $event)¶ saveVersionListener.
Parameters: - $event (MigrationEvent) –
-
onMigrationBefore
(MigrationEvent $event)¶ Parameters: - $event (MigrationEvent) –
-
onMigrationAfter
(MigrationEvent $event)¶ onMigrationAfter.
Parameters: - $event (MigrationEvent) –
-
onCollectionBefore
(CollectionEvent $event)¶ onCollectionBefore.
Parameters: - $event (CollectionEvent) –
-
onCollectionAfter
()¶ onCollectionAfter.
-
getStrategyOption
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
Returns: string
-
property
Baleen\Cli\CommandBus\Timeline\MigrateMessage¶
-
class
MigrateMessage
¶ Class MigrateMessage.
-
property
storage
¶ protected StorageInterface
-
property
timeline
¶ protected Timeline
-
property
config
¶ protected ConfigInterface
-
property
input
¶ protected InputInterface
-
property
output
¶ protected OutputInterface
-
property
cliCommand
¶ protected Command
-
configure
(Command $command)¶ Parameters: - $command (Command) –
-
getStorage
()¶ Returns: StorageInterface
-
setStorage
(StorageInterface $storage = null)¶ Parameters: - $storage (StorageInterface) –
-
getTimeline
()¶ Returns: Timeline
-
getConfig
()¶
-
setConfig
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
-
getInput
()¶
-
setInput
(InputInterface $input)¶ Parameters: - $input (InputInterface) –
-
getOutput
()¶
-
setOutput
(OutputInterface $output)¶ Parameters: - $output (OutputInterface) –
-
getCliCommand
()¶ Returns: Command
-
setCliCommand
(Command $cliCommand)¶ Parameters: - $cliCommand (Command) –
-
property
Baleen\Cli\CommandBus\Util¶
Baleen\Cli\CommandBus\Util\ComparatorAwareInterface¶
Baleen\Cli\CommandBus\Util\ComparatorAwareTrait¶
Baleen\Cli\CommandBus\Util\ConfigStorageAwareInterface¶
-
interface
ConfigStorageAwareInterface
¶ Interface ConfigStorageAwareInterface.
-
getConfigStorage
()¶ getConfigStorage.
Returns: mixed
-
setConfigStorage
(ConfigStorage $configStorage)¶ setConfigStorage.
Parameters: - $configStorage (ConfigStorage) –
Returns: mixed
-
Baleen\Cli\CommandBus\Util\ConfigStorageAwareTrait¶
-
trait
ConfigStorageAwareTrait
¶ Class ConfigStorageAwareTrait.
-
property
configStorage
¶ protected ConfigStorage
-
getConfigStorage
()¶ Returns: ConfigStorage
-
setConfigStorage
(ConfigStorage $configStorage)¶ Parameters: - $configStorage (ConfigStorage) –
-
property
Baleen\Cli\CommandBus\Util\FilesystemAwareInterface¶
Baleen\Cli\CommandBus\Util\FilesystemAwareTrait¶
Baleen\Cli\CommandBus\Util\RepositoryAwareInterface¶
Baleen\Cli\CommandBus\Util\RepositoryAwareTrait¶
-
trait
RepositoryAwareTrait
¶ Class RepositoryAwareTrait.
-
property
repository
¶ protected RepositoryInterface
-
property
filesystem
¶ protected Filesystem
-
getRepository
()¶ Returns: RepositoryInterface
-
setRepository
(RepositoryInterface $repository)¶ Parameters: - $repository (RepositoryInterface) –
-
getFilesystem
()¶ Returns: Filesystem
-
setFilesystem
(Filesystem $filesystem)¶ Parameters: - $filesystem (Filesystem) –
-
property
Baleen\Cli\CommandBus\Util\StorageAwareInterface¶
-
interface
StorageAwareInterface
¶ Interface StorageAwareInterface.
-
getStorage
()¶ Returns: StorageInterface
-
setStorage
(StorageInterface $storage = null)¶ Parameters: - $storage (StorageInterface) –
-
Baleen\Cli\CommandBus\Util\StorageAwareTrait¶
-
trait
StorageAwareTrait
¶ -
property
storage
¶ protected StorageInterface
-
getStorage
()¶ Returns: StorageInterface
-
setStorage
(StorageInterface $storage = null)¶ Parameters: - $storage (StorageInterface) –
-
property
Baleen\Cli\CommandBus\Util\TimelineAwareInterface¶
Baleen\Cli\Config¶
Baleen\Cli\Config\Config¶
-
class
Config
¶ Class Config.
-
__construct
($config =, []$defaults = true)¶ Parameters: - $config (array) –
- $defaults –
-
getDefaults
()¶ Returns: array
-
getMigrationDefaults
()¶ Default values for the migrations section.
Returns: array
-
getStorageDefaults
()¶ Default values for the storage section.
Returns: array
-
getProviderDefaults
()¶ Default values for the providers section.
Returns: array
-
getProviders
()¶ getProviders.
Returns: array
-
getMigrationsDirectoryPath
()¶ Returns: string
-
getMigrationsDirectory
()¶ Returns: mixed
-
getMigrationsNamespace
()¶ Returns: string
-
getStorageFilePath
()¶ Returns: string
-
getStorageFile
()¶ Returns: mixed
-
getConfigFilePath
()¶ Returns: string
-
getFileName
()¶ Returns: string
-
toArray
()¶ Returns: array
-
getDefinition
()¶ getDefinition.
Returns: Definition
-
getCleanArray
()¶ Returns a clone of itself but only with settings that can be configured by the end-user.
Returns: array
-
Baleen\Cli\Config\ConfigInterface¶
-
interface
ConfigInterface
¶ Interface ConfigInterface provides a common interface to be extended for applications based on this framework. The resulting class will provide the config configClass (see Symfony’s ConfigurationInterface).
-
getDefaults
()¶ Returns an array of default values.
Returns: array
-
toArray
()¶ Returns the entire configuration as an array,.
Returns: array
-
getFileName
()¶ Returns the default configuration file name.
Returns: string
-
getDefinition
()¶ Returns an instance of the configuration definition.
Returns: ConfigurationInterface
-
getCleanArray
()¶ Returns an array only with settings that can be configured by the end-user.
Returns: array
-
Baleen\Cli\Config\ConfigStorage¶
-
class
ConfigStorage
¶ Class ConfigStorage.
-
property
projectFileSystem
¶ protected FilesystemInterface
-
property
localConfigStack
¶ protected array
-
property
processor
¶ protected Processor
-
property
configClass
¶ protected string
-
property
definition
¶ protected ConfigurationInterface
-
property
defaultFileName
¶ protected string
-
__construct
($configClass, FilesystemInterface $projectFileSystem, $localConfigStack =[])¶ ConfigStorage constructor.
Parameters: - $configClass –
- $projectFileSystem (FilesystemInterface) –
- $localConfigStack –
-
load
($configFileName = null)¶ Parameters: - $configFileName (string) – The path to the consumer’s config file (eg .baleen.yml) relative to the project filesystem
Returns: Config
-
write
(ConfigInterface $config)¶ Parameters: - $config (ConfigInterface) –
Returns: bool
-
isInitialized
(ConfigInterface $config)¶ Returns whether the specified configuration has an existing user-facing config file.
Parameters: - $config (ConfigInterface) –
Returns: bool
-
property
Baleen\Cli\Exception¶
Baleen\Cli\Exception\CliException¶
-
class
CliException
¶ Class CliException.
-
property
message
¶ protected
-
property
code
¶ protected
-
property
file
¶ protected
-
property
line
¶ protected
-
__clone
()¶
-
__construct
($message, $code, $previous)¶ Parameters: - $message –
- $code –
- $previous –
-
__wakeup
()¶
-
getMessage
()¶
-
getCode
()¶
-
getFile
()¶
-
getLine
()¶
-
getTrace
()¶
-
getPrevious
()¶
-
getTraceAsString
()¶
-
__toString
()¶
-
property
Baleen\Cli\Provider¶
Baleen\Cli\Provider\ApplicationProvider¶
Baleen\Cli\Provider\CommandsProvider¶
-
class
CommandsProvider
¶ Class CommandsProvider.
-
property
provides
¶ protected
-
property
commands
¶ protected array
-
__construct
()¶
-
register
()¶ Use the register method to register items with the container via the protected $this->container property or the getContainer method from the ContainerAwareTrait.
-
property
Baleen\Cli\Provider\ConfigProvider¶
Baleen\Cli\Provider\HelperSetProvider¶
Baleen\Cli\Provider\RepositoryProvider¶
Baleen\Cli\Provider\Services¶
-
interface
Services
¶ This interface contains constants for the names of services in the Service Container. Its useful in order to: A) reduce the coupling between classes for service providers (since they can use a single interface to reference services) and B) provide an easy way to override certain services for libraries that use Baleen CLI as their framework.
-
constant
CONFIG
¶ Reference to the Config service
-
constant
CONFIG_STORAGE
¶ Reference to the ConfigStorage service
-
constant
BALEEN_BASE_DIR
¶ Reference to Baleen CLI’s base directory
-
constant
COMMAND_BUS
¶ Reference to the CommandBus service
-
constant
COMMANDS
¶ Reference to an array of available commands
-
constant
CMD_CONFIG_INIT
¶ Reference to the config:init command
-
constant
CMD_CONFIG_STATUS
¶ Reference to the config:status command
-
constant
CMD_TIMELINE_EXECUTE
¶ Reference to the timeline:execute command
-
constant
CMD_TIMELINE_MIGRATE
¶ Reference to the timelien:migrate command
-
constant
CMD_REPOSITORY_CREATE
¶ Reference to the repository:create command
-
constant
CMD_REPOSITORY_LATEST
¶ Reference to the repository:latest command
-
constant
CMD_REPOSITORY_LIST
¶ Reference to the repository:list command
-
constant
CMD_STORAGE_LATEST
¶ Reference to the storage:latest command
-
constant
APPLICATION
¶ Reference to the Symfony Console Application instance
-
constant
AUTOLOADER
¶ Reference to the Composer autoloader
-
constant
HELPERSET
¶ Reference to the Symfony Console HelperSet to be used for the Application
-
constant
HELPERSET_QUESTION
¶ Reference to the Question console helper
-
constant
HELPERSET_CONFIG
¶ Reference to the Config console helper
-
constant
REPOSITORY
¶ Reference to the Repository service
-
constant
REPOSITORY_FILESYSTEM
¶ Reference to the Filesystem to be used for the Repository service
-
constant
MIGRATION_FACTORY
¶ Reference to the factory to be used to instantiate Migrations
-
constant
STORAGE
¶ Reference to the Storage service
-
constant
TIMELINE
¶ Reference to the Timeline service
-
constant
COMPARATOR
¶ Reference to the Comparator service
-
constant