CacheWarmupCommand
class CacheWarmupCommand extends Command
Warmup the cache.
Methods
static string|null | getDefaultName() | from Command |
__construct(CacheWarmerAggregate $cacheWarmer) | ||
ignoreValidationErrors() Ignores validation errors. | from Command | |
setApplication(Application $application = null) | from Command | |
setHelperSet(HelperSet $helperSet) | from Command | |
HelperSet | getHelperSet() Gets the helper set. | from Command |
Application | getApplication() Gets the application instance for this command. | from Command |
bool | isEnabled() Checks whether the command is enabled or not in the current environment. | from Command |
int | run(InputInterface $input, OutputInterface $output) Runs the command. | from Command |
$this | setCode(callable $code) Sets the code to execute when running this command. | from Command |
mergeApplicationDefinition(bool $mergeArgs = true) Merges the application definition with the command definition. | from Command | |
$this | setDefinition(array|InputDefinition $definition) Sets an array of argument and option instances. | from Command |
InputDefinition | getDefinition() Gets the InputDefinition attached to this Command. | from Command |
InputDefinition | getNativeDefinition() Gets the InputDefinition to be used to create representations of this Command. | from Command |
$this | addArgument(string $name, int $mode = null, string $description = '', mixed $default = null) Adds an argument. | from Command |
$this | addOption(string $name, string $shortcut = null, int $mode = null, string $description = '', mixed $default = null) Adds an option. | from Command |
$this | setName(string $name) Sets the name of the command. | from Command |
$this | setProcessTitle(string $title) Sets the process title of the command. | from Command |
string | getName() Returns the command name. | from Command |
Command | setHidden(bool $hidden) | from Command |
bool | isHidden() | from Command |
$this | setDescription(string $description) Sets the description for the command. | from Command |
string | getDescription() Returns the description for the command. | from Command |
$this | setHelp(string $help) Sets the help for the command. | from Command |
string | getHelp() Returns the help for the command. | from Command |
string | getProcessedHelp() Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically. | from Command |
$this | setAliases(string[] $aliases) Sets the aliases for the command. | from Command |
array | getAliases() Returns the aliases for the command. | from Command |
string | getSynopsis(bool $short = false) Returns the synopsis for the command. | from Command |
$this | addUsage(string $usage) Add a command usage example. | from Command |
array | getUsages() Returns alternative usages of the command. | from Command |
mixed | getHelper(string $name) Gets a helper instance by name. | from Command |
Details
static string|null getDefaultName()
Return Value
string|null | The default command name or null when no default name is set |
__construct(CacheWarmerAggregate $cacheWarmer)
Parameters
CacheWarmerAggregate | $cacheWarmer |
Exceptions
LogicException | When the command name is empty |
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
setApplication(Application $application = null)
Parameters
Application | $application |
setHelperSet(HelperSet $helperSet)
Parameters
HelperSet | $helperSet |
HelperSet getHelperSet()
Gets the helper set.
Return Value
HelperSet | A HelperSet instance |
Application getApplication()
Gets the application instance for this command.
Return Value
Application | An Application instance |
bool isEnabled()
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.
Return Value
bool |
int run(InputInterface $input, 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
InputInterface | $input | |
OutputInterface | $output |
Return Value
int | The command exit code |
Exceptions
Exception | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
See also
setCode() | |
execute() |
$this setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
Parameters
callable | $code | A callable(InputInterface $input, OutputInterface $output) |
Return Value
$this |
Exceptions
InvalidArgumentException |
See also
execute() |
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
Parameters
bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
$this setDefinition(array|InputDefinition $definition)
Sets an array of argument and option instances.
Parameters
array|InputDefinition | $definition | An array of argument and option instances or a definition instance |
Return Value
$this |
InputDefinition getDefinition()
Gets the InputDefinition attached to this Command.
Return Value
InputDefinition | An InputDefinition instance |
InputDefinition getNativeDefinition()
Gets the InputDefinition to be used to create 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.
This method is not part of public API and should not be used directly.
Return Value
InputDefinition | An InputDefinition instance |
$this addArgument(string $name, int $mode = null, string $description = '', mixed $default = null)
Adds an argument.
Parameters
string | $name | The argument name |
int | $mode | The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL |
string | $description | A description text |
mixed | $default | The default value (for InputArgument::OPTIONAL mode only) |
Return Value
$this |
$this addOption(string $name, string $shortcut = null, int $mode = null, string $description = '', mixed $default = null)
Adds an option.
Parameters
string | $name | The option name |
string | $shortcut | The shortcut (can be null) |
int | $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_NONE) |
Return Value
$this |
$this setName(string $name)
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 |
Return Value
$this |
Exceptions
InvalidArgumentException | When the name is invalid |
$this setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
Parameters
string | $title | The process title |
Return Value
$this |
string getName()
Returns the command name.
Return Value
string | The command name |
Command setHidden(bool $hidden)
Parameters
bool | $hidden | Whether or not the command should be hidden from the list of commands |
Return Value
Command | The current instance |
bool isHidden()
Return Value
bool | whether the command should be publicly shown or not |
$this setDescription(string $description)
Sets the description for the command.
Parameters
string | $description | The description for the command |
Return Value
$this |
string getDescription()
Returns the description for the command.
Return Value
string | The description for the command |
$this setHelp(string $help)
Sets the help for the command.
Parameters
string | $help | The help for the command |
Return Value
$this |
string getHelp()
Returns the help for the command.
Return Value
string | The help for the command |
string getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically.
Return Value
string | The processed help for the command |
$this setAliases(string[] $aliases)
Sets the aliases for the command.
Parameters
string[] | $aliases | An array of aliases for the command |
Return Value
$this |
Exceptions
InvalidArgumentException | When an alias is invalid |
array getAliases()
Returns the aliases for the command.
Return Value
array | An array of aliases for the command |
string getSynopsis(bool $short = false)
Returns the synopsis for the command.
Parameters
bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
Return Value
string | The synopsis |
$this addUsage(string $usage)
Add a command usage example.
Parameters
string | $usage | The usage, it'll be prefixed with the command name |
Return Value
$this |
array getUsages()
Returns alternative usages of the command.
Return Value
array |
mixed getHelper(string $name)
Gets a helper instance by name.
Parameters
string | $name | The helper name |
Return Value
mixed | The helper value |
Exceptions
LogicException | if no HelperSet is defined |
InvalidArgumentException | if the helper is not defined |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.html