Print out command list
$commands
protected asText( Cake\Console\ConsoleIo $io , ArrayIterator $commands )
Output text.
Cake\Console\ConsoleIo
$io
$commands
asXml( Cake\Console\ConsoleIo $io , ArrayIterator $commands )
Output as XML
Cake\Console\ConsoleIo
$io
$commands
buildOptionParser( Cake\Console\ConsoleOptionParser $parser )
Gets the option parser instance and configures it.
Cake\Console\ConsoleOptionParser
$parser
Cake\Console\ConsoleOptionParser
Cake\Console\Command::buildOptionParser()
execute( Cake\Console\Arguments $args , Cake\Console\ConsoleIo $io )
Main function Prints out the list of shells.
Cake\Console\Arguments
$args
Cake\Console\ConsoleIo
$io
Cake\Console\Command::execute()
setCommandCollection( Cake\Console\CommandCollection $commands )
Set the command collection being used.
Cake\Console\CommandCollection
$commands
Cake\Console\CommandCollectionAwareInterface::setCommandCollection()
__construct( )
Constructor
By default CakePHP will construct command objects when building the CommandCollection for your application.
abort( integer $code self::CODE_ERROR )
Halt the the current process with a StopException.
$code
optional self::CODE_ERROR Cake\Console\Exception\StopException
displayHelp( Cake\Console\ConsoleOptionParser $parser , Cake\Console\Arguments $args , Cake\Console\ConsoleIo $io )
Output help content
Cake\Console\ConsoleOptionParser
$parser
Cake\Console\Arguments
$args
Cake\Console\ConsoleIo
$io
getOptionParser( )
Get the option parser.
You can override buildOptionParser() to define your options & arguments.
Cake\Console\ConsoleOptionParser
initialize( )
Hook method invoked by CakePHP when a command is about to be executed.
Override this method and implement expensive/important setup steps that should not run on every command run. This method will be called before the options and arguments are validated and processed.
run( array $argv , Cake\Console\ConsoleIo $io )
Run the command.
$argv
Cake\Console\ConsoleIo
$io
setName( string $name )
Set the name this command uses in the collection.
Generally invoked by the CommandCollection when the command is added. Required to have at least one space in the name so that the root command can be calculated.
$name
setOutputLevel( Cake\Console\Arguments $args , Cake\Console\ConsoleIo $io )
Set the output level based on the Arguments.
Cake\Console\Arguments
$args
Cake\Console\ConsoleIo
$io
getTableLocator( )
Gets the table locator.
Cake\ORM\Locator\LocatorInterface
setTableLocator( Cake\ORM\Locator\LocatorInterface $tableLocator )
Sets the table locator.
Cake\ORM\Locator\LocatorInterface
$tableLocator
tableLocator( Cake\ORM\Locator\LocatorInterface $tableLocator null )
Sets the table locator. If no parameters are passed, it will return the currently used locator.
Cake\ORM\Locator\LocatorInterface
$tableLocator
optional null Cake\ORM\Locator\LocatorInterface
log( mixed $msg , integer|string $level LogLevel::ERROR , string|array $context [] )
Convenience method to write a message to Log. See Log::write() for more information on writing to logs.
$msg
$level
optional LogLevel::ERROR $context
optional [] _setModelClass( string $name )
Set the modelClass and modelKey properties based on conventions.
If the properties are already set they will not be overwritten
$name
getModelType( )
Get the model type to be used by this class
loadModel( string|null $modelClass null , string|null $modelType null )
Loads and constructs repository objects required by this object
Typically used to load ORM Table objects as required. Can also be used to load other types of repository objects your application uses.
If a repository provider does not return an object a MissingModelException will be thrown.
$modelClass
optional null $modelType
optional null Cake\Datasource\RepositoryInterface
Cake\Datasource\Exception\MissingModelException
modelFactory( string $type , callable $factory )
Override a existing callable to generate repositories of a given type.
$type
$factory
modelType( string|null $modelType null )
Set or get the model type to be used by this class
$modelType
optional null Cake\Datasource\ModelAwareTrait
setModelType( string $modelType )
Set the model type to be used by this class
$modelType
© 2005–2018 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.6/class-Cake.Command.HelpCommand.html