Yii predefines a set of aliases to easily reference commonly used file paths and URLs:
@ -125,7 +125,7 @@ The rest of the aliases are defined in the application constructor when applying
> Note: `@web` and `@webroot` aliases as their descriptions indicate are defined within [[yii\web\Application|Web application]] and therefore are not available for [[yii\console\Application|Console application]] by default.
When building `WHERE` conditions based on input from end users, you usually want to ignore those input values, that are empty.
For example, in a search form that allows you to search by username and email, you would like to ignore the username/email
@ -625,7 +625,7 @@ $mainQuery = (new \yii\db\Query())
[[yii\db\Query::withQuery()|withQuery()]] can be called multiple times to prepend more CTE's to main query. Queries will be prepend in same order as they attached. If one of query is recursive then whole CTE become recursive.
## Query Methods
## Query Methods<spanid="query-methods"></span>
[[yii\db\Query]] provides a whole set of methods for different query purposes:
@ -867,7 +867,7 @@ $unbufferedDb->close();
It is recommended to design your own code with your production practice for extra massive data,
[for example, divide the range for integer keys, loop them with Unbuffered Queries](https://github.com/yiisoft/yii2/issues/8420#issuecomment-296109257).
### Adding custom Conditions and Expressions
### Adding custom Conditions and Expressions<spanid="adding-custom-conditions-and-expressions"></span>
As it was mentioned in [Conditions –Object Format](#object-format) chapter, it is possible to create custom condition
classes. For example, let's create a condition that will check that specific columns are less than some value.
Please refer to the [Url manager docs](runtime-routing.md) section for more details.
An important change in the naming convention for routes is that camel case names of controllers
and actions are now converted to lower case where each word is separated by a hyphen, e.g. the controller
and actions are now converted to lower case where each word is separated by a hypen, e.g. the controller
id for the `CamelCaseController` will be `camel-case`.
See the section about [controller IDs](structure-controllers.md#controller-ids) and [action IDs](structure-controllers.md#action-ids) for more details.
@ -536,5 +536,5 @@ Using Yii 1.1 and 2.x together
------------------------------
If you have legacy Yii 1.1 code that you want to use together with Yii 2.0, please refer to
the [Using Yii 1.1 and 2.0 Together](tutorial-yii-integration.md#using-both-yii2-with-yii) section.
the [Using Yii 1.1 and 2.0 Together](tutorial-yii-integration.md#using-both-yii2-yii1) section.
[[yii\grid\DataColumn|Data column]] is used for displaying and sorting data. It is the default column type so the specifying class could be omitted when
The message translation service translates a text message from one language (usually the [[yii\base\Application::$sourceLanguage|source language]])
@ -127,7 +127,7 @@ message source.
The [[yii\i18n\PhpMessageSource]] class uses PHP files with a simple PHP array to store message translations.
These files contain a map of the messages in `source language` to the translation in the `target language`.
> Info: You can automatically generate these PHP files by using the [`message` command](#using-the-message-command),
> Info: You can automatically generate these PHP files by using the [`message` command](#message-command),
> which will be introduced later in this chapter.
Each PHP file corresponds to the messages of a single category. By default, the file name should be the same as
@ -679,7 +679,7 @@ If [[yii\i18n\MissingTranslationEvent::translatedMessage]] is set by the event h
> and wish them to treat the missing translations in the same way, you should assign the corresponding event handler to each of them.
### Using the `message` command
### Using the `message` command<spanid="message-command"></span>
Translations can be stored in [[yii\i18n\PhpMessageSource|php files]], [[yii\i18n\GettextMessageSource|.po files]] or in a [[yii\i18n\DbMessageSource|database]]. See specific classes for additional options.
@ -736,7 +736,7 @@ to render the view `views/site/index.php`, it will end up rendering the translat
See the [Data Formatting](output-formatting.md) section for details.
## Setting Up PHP Environment
## Setting Up PHP Environment<spanid="setup-environment"></span>
Yii uses the [PHP intl extension](https://secure.php.net/manual/en/book.intl.php) to provide most of its I18N features,
such as the date and number formatting of the [[yii\i18n\Formatter]] class and the message formatting using [[yii\i18n\MessageFormatter]].