Properties

$application

$application : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$name

$name : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$aliases

$aliases : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$definition

$definition : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$help

$help : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$description

$description : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$ignoreValidationErrors

$ignoreValidationErrors : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$applicationDefinitionMerged

$applicationDefinitionMerged : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$code

$code : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$synopsis

$synopsis : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$helperSet

$helperSet : 

Type

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

$command

$command : 

Type

Tags

None found

Methods

__construct()

__construct(string  $name = null) 

Constructor.

Parameters

string $name

The name of the command

Throws

LogicException

When the command name is empty

ignoreValidationErrors()

ignoreValidationErrors() 

Ignores validation errors.

This is mainly useful for the help command.

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

setApplication()

setApplication(\Symfony\Component\Console\Application  $application = null) 

Sets the application instance for this command.

Parameters

SymfonyComponentConsoleApplication $application

An Application instance

setHelperSet()

setHelperSet(\Symfony\Component\Console\Helper\HelperSet  $helperSet) 

Sets the helper set.

Parameters

SymfonyComponentConsoleHelperHelperSet $helperSet

A HelperSet instance

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

getHelperSet()

getHelperSet() : \Symfony\Component\Console\Helper\HelperSet

Gets the helper set.

Returns

SymfonyComponentConsoleHelperHelperSet

A HelperSet instance

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

getApplication()

getApplication() : \Symfony\Component\Console\Application

Gets the application instance for this command.

Returns

SymfonyComponentConsoleApplication

An Application instance

isEnabled()

isEnabled() : Boolean

Checks whether the command is enabled or not in the current environment

Override this to check for x or y and return false if the command can not run properly under the current conditions.

Returns

Boolean

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

run()

run(\Symfony\Component\Console\Input\InputInterface  $input, \Symfony\Component\Console\Output\OutputInterface  $output) 

Runs the command.

The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.

Parameters

SymfonyComponentConsoleInputInputInterface $input

An InputInterface instance

SymfonyComponentConsoleOutputOutputInterface $output

An OutputInterface instance

Inherited from
SymfonyComponentConsoleCommandCommand
See also

Tags

api

setCode()

setCode(\Closure  $code) : \Symfony\Component\Console\Command\Command

Sets the code to execute when running this command.

If this method is used, it overrides the code defined in the execute() method.

Parameters

Closure $code

A Closure

Returns

SymfonyComponentConsoleCommandCommand

The current instance

Inherited from
SymfonyComponentConsoleCommandCommand
See also

Tags

api

setDefinition()

setDefinition(array|\Symfony\Component\Console\Input\InputDefinition  $definition) : \Symfony\Component\Console\Command\Command

Sets an array of argument and option instances.

Parameters

array|SymfonyComponentConsoleInputInputDefinition $definition

An array of argument and option instances or a definition instance

Returns

SymfonyComponentConsoleCommandCommand

The current instance

getDefinition()

getDefinition() : \Symfony\Component\Console\Input\InputDefinition

Gets the InputDefinition attached to this Command.

Returns

SymfonyComponentConsoleInputInputDefinition

An InputDefinition instance

addArgument()

addArgument(string  $name, integer  $mode = null, string  $description = '', mixed  $default = null) : \Symfony\Component\Console\Command\Command

Adds an argument.

Parameters

string $name

The argument name

integer $mode

The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL

string $description

A description text

mixed $default

The default value (for InputArgument::OPTIONAL mode only)

Returns

SymfonyComponentConsoleCommandCommand

The current instance

addOption()

addOption(string  $name, string  $shortcut = null, integer  $mode = null, string  $description = '', mixed  $default = null) : \Symfony\Component\Console\Command\Command

Adds an option.

Parameters

string $name

The option name

string $shortcut

The shortcut (can be null)

integer $mode

The option mode: One of the InputOption::VALUE_* constants

string $description

A description text

mixed $default

The default value (must be null for InputOption::VALUE_REQUIRED or InputOption::VALUE_NONE)

Returns

SymfonyComponentConsoleCommandCommand

The current instance

setName()

setName(string  $name) : \Symfony\Component\Console\Command\Command

Sets the name of the command.

This method can set both the namespace and the name if you separate them by a colon (:)

$command->setName('foo:bar');

Parameters

string $name

The command name

Throws

InvalidArgumentException

When command name given is empty

Returns

SymfonyComponentConsoleCommandCommand

The current instance

getName()

getName() : string

Returns the command name.

Returns

string —

The command name

setDescription()

setDescription(string  $description) : \Symfony\Component\Console\Command\Command

Sets the description for the command.

Parameters

string $description

The description for the command

Returns

SymfonyComponentConsoleCommandCommand

The current instance

getDescription()

getDescription() : string

Returns the description for the command.

Returns

string —

The description for the command

setHelp()

setHelp(string  $help) : \Symfony\Component\Console\Command\Command

Sets the help for the command.

Parameters

string $help

The help for the command

Returns

SymfonyComponentConsoleCommandCommand

The current instance

getHelp()

getHelp() : string

Returns the help for the command.

Returns

string —

The help for the command

getProcessedHelp()

getProcessedHelp() : string

Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically.

Returns

string —

The processed help for the command

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

setAliases()

setAliases(array  $aliases) : \Symfony\Component\Console\Command\Command

Sets the aliases for the command.

Parameters

array $aliases

An array of aliases for the command

Returns

SymfonyComponentConsoleCommandCommand

The current instance

getAliases()

getAliases() : array

Returns the aliases for the command.

Returns

array —

An array of aliases for the command

getSynopsis()

getSynopsis() : string

Returns the synopsis for the command.

Returns

string —

The synopsis

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

getHelper()

getHelper(string  $name) : mixed

Gets a helper instance by name.

Parameters

string $name

The helper name

Throws

InvalidArgumentException

if the helper is not defined

Returns

mixed —

The helper value

asText()

asText() : string

Returns a text representation of the command.

Returns

string —

A string representing the command

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

asXml()

asXml(Boolean  $asDom = false) : string|\Symfony\Component\Console\Command\DOMDocument

Returns an XML representation of the command.

Parameters

Boolean $asDom

Whether to return a DOM or an XML string

Returns

string|SymfonyComponentConsoleCommandDOMDocument —

An XML string representing the command

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

setCommand()

setCommand(\Symfony\Component\Console\Command\Command  $command) 

Sets the command

Parameters

SymfonyComponentConsoleCommandCommand $command

The command to set

Tags

None found

configure()

configure() 

Configures the current command.

Tags

None found

execute()

execute(\Symfony\Component\Console\Input\InputInterface  $input, \Symfony\Component\Console\Output\OutputInterface  $output) : integer

Executes the current command.

This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.

Parameters

SymfonyComponentConsoleInputInputInterface $input

An InputInterface instance

SymfonyComponentConsoleOutputOutputInterface $output

An OutputInterface instance

Returns

integer —

0 if everything went fine, or an error code

Tags

None found

interact()

interact(\Symfony\Component\Console\Input\InputInterface  $input, \Symfony\Component\Console\Output\OutputInterface  $output) 

Interacts with the user.

Parameters

SymfonyComponentConsoleInputInputInterface $input

An InputInterface instance

SymfonyComponentConsoleOutputOutputInterface $output

An OutputInterface instance

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

initialize()

initialize(\Symfony\Component\Console\Input\InputInterface  $input, \Symfony\Component\Console\Output\OutputInterface  $output) 

Initializes the command just after the input has been validated.

This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.

Parameters

SymfonyComponentConsoleInputInputInterface $input

An InputInterface instance

SymfonyComponentConsoleOutputOutputInterface $output

An OutputInterface instance

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

getNativeDefinition()

getNativeDefinition() : \Symfony\Component\Console\Input\InputDefinition

Gets the InputDefinition to be used to create XML and Text representations of this Command.

Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.

Returns

SymfonyComponentConsoleInputInputDefinition

An InputDefinition instance

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

mergeApplicationDefinition()

mergeApplicationDefinition() 

Merges the application definition with the command definition.

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found

validateName()

validateName(  $name) 

Parameters

$name

Inherited from
SymfonyComponentConsoleCommandCommand

Tags

None found