diff --git a/docs/guide/console.md b/docs/guide/console.md index 86ba6d5..9bc6069 100644 --- a/docs/guide/console.md +++ b/docs/guide/console.md @@ -7,7 +7,7 @@ consists of one or more [[\yii\console\Controller]] (often referred to as comman Usage ----- -User executes controller action using the following syntax: +You can execute controller action using the following syntax: ``` yii [--param1=value1 --param2 ...] @@ -20,13 +20,54 @@ line like the following: yii migreate/create --migrationTable=my_migration ``` +In the above `yii` is console application entry script described below. + Entry script ------------ +Console application entry script is typically called `yii`, located in your application root directory and contains +code like the following: + +```php +#!/usr/bin/env php +run(); +exit($exitCode); + +``` + +This script is a part of your application so you're free to adjust it. There `YII_DEBUG` can be turned off if you do +not want to see stacktrace on error and want to improve overall performance. In both basic and advanced application +templates it is enabled to provide more developer-friendly environment. Configuration ------------- +As can be seen in the code above, console application uses its own config files named `console.php` so you need to +configure database connection and the rest of the components you're going to use there in that file. If web and console +application configs have a lot in common it's a good idea to move matching parts into their own config files as it was +done in advanced application template. + + Creating your own console commands ---------------------------------- @@ -36,4 +77,7 @@ Creating your own console commands ### Parameters -### Return codes \ No newline at end of file +### Return codes + +Using return codes is the best practice of console application development. If command returns `0` it means everything +is OK. If it is a number more than zero, we have an error and integer returned is the error code. \ No newline at end of file