Commit 6ebcd9ac by Carsten Brandt

fixed absolute class links in guide

parent c46b35b1
......@@ -59,7 +59,7 @@ Asset bundles are regular classes so if you need to define another one, just cre
class can be placed anywhere but the convention for it is to be under `assets` directory of the application.
Additionally you may specify `$jsOptions`, `$cssOptions` and `$publishOptions` that will be passed to
[[\yii\web\View::registerJsFile()]], [[\yii\web\View::registerCssFile()]] and [[\yii\web\AssetManager::publish()]]
[[yii\web\View::registerJsFile()]], [[yii\web\View::registerCssFile()]] and [[yii\web\AssetManager::publish()]]
respectively during registering and publising an asset.
Registering asset bundle
......
......@@ -3,7 +3,7 @@ Authentication
Authentication is the act of verifying who a user is, and is the basis of the login process. Typically, authentication uses the combination of an identifier--a username or email address--and a password. The user submits these values through a form, and the application then compares the submitted information against that previously stored (e.g., upon registration).
In Yii, this entire process is performed semi-automatically, leaving the developer to merely implement [[\yii\web\IdentityInterface]], the most important class in the authentication system. Typically, implementation of `IdentityInterface` is accomplished using the `User` model.
In Yii, this entire process is performed semi-automatically, leaving the developer to merely implement [[yii\web\IdentityInterface]], the most important class in the authentication system. Typically, implementation of `IdentityInterface` is accomplished using the `User` model.
You can find a full featured example of authentication in the
[advanced application template](installation.md). Below, only the interface methods are listed:
......
......@@ -7,7 +7,7 @@ of controlling it.
Access control basics
---------------------
Basic access control is very simple to implement using [[\yii\web\AccessControl]]:
Basic access control is very simple to implement using [[yii\web\AccessControl]]:
```php
class SiteController extends Controller
......@@ -38,7 +38,7 @@ class SiteController extends Controller
In the code above we're attaching access control behavior to a controller. Since there's `only` option specified, it
will be applied to 'login', 'logout' and 'signup' actions only. A set of rules that are basically options for
[[\yii\web\AccessRule]] reads as follows:
[[yii\web\AccessRule]] reads as follows:
- Allow all guest (not yet authenticated) users to access 'login' and 'signup' actions.
- Allow authenticated users to access 'logout' action.
......@@ -46,7 +46,7 @@ will be applied to 'login', 'logout' and 'signup' actions only. A set of rules t
Rules are checked one by one from top to bottom. If rule matches, action takes place immediately. If not, next rule is
checked. If no rules matched access is denied.
[[\yii\web\AccessRule]] is quite flexible and allows additionally to what was demonstrated checking IPs and request method
[[yii\web\AccessRule]] is quite flexible and allows additionally to what was demonstrated checking IPs and request method
(i.e. POST, GET). If it's not enough you can specify your own check via anonymous function:
```php
......
......@@ -38,38 +38,38 @@ When the application is running, the cache component can be accessed through `Yi
Yii provides various cache components that can store cached data in different media. The following
is a summary of the available cache components:
* [[\yii\caching\ApcCache]]: uses PHP [APC](http://php.net/manual/en/book.apc.php) extension. This option can be
* [[yii\caching\ApcCache]]: uses PHP [APC](http://php.net/manual/en/book.apc.php) extension. This option can be
considered as the fastest one when dealing with cache for a centralized thick application (e.g. one
server, no dedicated load balancers, etc.).
* [[\yii\caching\DbCache]]: uses a database table to store cached data. By default, it will create and use a
* [[yii\caching\DbCache]]: uses a database table to store cached data. By default, it will create and use a
[SQLite3](http://sqlite.org/) database under the runtime directory. You can explicitly specify a database for
it to use by setting its `db` property.
* [[\yii\caching\DummyCache]]: presents dummy cache that does no caching at all. The purpose of this component
* [[yii\caching\DummyCache]]: presents dummy cache that does no caching at all. The purpose of this component
is to simplify the code that needs to check the availability of cache. For example, during development or if
the server doesn't have actual cache support, we can use this cache component. When an actual cache support
is enabled, we can switch to use the corresponding cache component. In both cases, we can use the same
code `Yii::$app->cache->get($key)` to attempt retrieving a piece of data without worrying that
`Yii::$app->cache` might be `null`.
* [[\yii\caching\FileCache]]: uses standard files to store cached data. This is particular suitable
* [[yii\caching\FileCache]]: uses standard files to store cached data. This is particular suitable
to cache large chunk of data (such as pages).
* [[\yii\caching\MemCache]]: uses PHP [memcache](http://php.net/manual/en/book.memcache.php)
* [[yii\caching\MemCache]]: uses PHP [memcache](http://php.net/manual/en/book.memcache.php)
and [memcached](http://php.net/manual/en/book.memcached.php) extensions. This option can be considered as
the fastest one when dealing with cache in a distributed applications (e.g. with several servers, load
balancers, etc.)
* [[\yii\redis\Cache]]: implements a cache component based on [Redis](http://redis.io/) key-value store
* [[yii\redis\Cache]]: implements a cache component based on [Redis](http://redis.io/) key-value store
(redis version 2.6.12 or higher is required).
* [[\yii\caching\WinCache]]: uses PHP [WinCache](http://iis.net/downloads/microsoft/wincache-extension)
* [[yii\caching\WinCache]]: uses PHP [WinCache](http://iis.net/downloads/microsoft/wincache-extension)
([see also](http://php.net/manual/en/book.wincache.php)) extension.
* [[\yii\caching\XCache]]: uses PHP [XCache](http://xcache.lighttpd.net/) extension.
* [[yii\caching\XCache]]: uses PHP [XCache](http://xcache.lighttpd.net/) extension.
* [[\yii\caching\ZendDataCache]]: uses
* [[yii\caching\ZendDataCache]]: uses
[Zend Data Cache](http://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm)
as the underlying caching medium.
......@@ -91,7 +91,7 @@ Data Caching
------------
Data caching is about storing some PHP variable in cache and retrieving it later from cache. For this purpose,
the cache component base class [[\yii\caching\Cache]] provides two methods that are used most of the time:
the cache component base class [[yii\caching\Cache]] provides two methods that are used most of the time:
[[yii\caching\Cache::set()|set()]] and [[yii\caching\Cache::get()|get()]]. Note, only serializable variables and objects could be cached successfully.
To store a variable `$value` in cache, we choose a unique `$key` and call [[yii\caching\Cache::set()|set()]] to store it:
......@@ -158,7 +158,7 @@ Besides expiration setting, cached data may also be invalidated according to som
are caching the content of some file and the file is changed, we should invalidate the cached copy and read the latest
content from the file instead of the cache.
We represent a dependency as an instance of [[\yii\caching\Dependency]] or its child class. We pass the dependency
We represent a dependency as an instance of [[yii\caching\Dependency]] or its child class. We pass the dependency
instance along with the data to be cached when calling [[yii\caching\Cache::set()|set()]].
```php
......@@ -174,12 +174,12 @@ get a false value, indicating the data needs to be regenerated.
Below is a summary of the available cache dependencies:
- [[\yii\caching\FileDependency]]: the dependency is changed if the file's last modification time is changed.
- [[\yii\caching\GroupDependency]]: marks a cached data item with a group name. You may invalidate the cached data items
with the same group name all at once by calling [[\yii\caching\GroupDependency::invalidate()]].
- [[\yii\caching\DbDependency]]: the dependency is changed if the query result of the specified SQL statement is changed.
- [[\yii\caching\ChainedDependency]]: the dependency is changed if any of the dependencies on the chain is changed.
- [[\yii\caching\ExpressionDependency]]: the dependency is changed if the result of the specified PHP expression is
- [[yii\caching\FileDependency]]: the dependency is changed if the file's last modification time is changed.
- [[yii\caching\GroupDependency]]: marks a cached data item with a group name. You may invalidate the cached data items
with the same group name all at once by calling [[yii\caching\GroupDependency::invalidate()]].
- [[yii\caching\DbDependency]]: the dependency is changed if the query result of the specified SQL statement is changed.
- [[yii\caching\ChainedDependency]]: the dependency is changed if any of the dependencies on the chain is changed.
- [[yii\caching\ExpressionDependency]]: the dependency is changed if the result of the specified PHP expression is
changed.
### Query Caching
......
......@@ -104,7 +104,7 @@ You can use them to write database independent migrations.
For example `pk` will be replaced by `int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY`
for MySQL and `integer PRIMARY KEY AUTOINCREMENT NOT NULL` for sqlite.
See documentation of [[yii\db\QueryBuilder::getColumnType()]] for more details and a list
of available types. You may also use the constants defined in [[\yii\db\Schema]] to
of available types. You may also use the constants defined in [[yii\db\Schema]] to
define column types.
......
......@@ -2,7 +2,7 @@ Console applications
====================
Yii has full featured support of console. Console application structure in Yii is very similar to web application. It
consists of one or more [[\yii\console\Controller]] (often referred to as commands). Each has one or more actions.
consists of one or more [[yii\console\Controller]] (often referred to as commands). Each has one or more actions.
Usage
-----
......
......@@ -11,7 +11,7 @@ Basics
Controller resides in application's `controllers` directory and is named like `SiteController.php`,
where the `Site` part could be anything describing a set of actions it contains.
The basic web controller is a class that extends [[\yii\web\Controller]] and could be very simple:
The basic web controller is a class that extends [[yii\web\Controller]] and could be very simple:
```php
namespace app\controllers;
......@@ -97,12 +97,12 @@ In case module, controller or action specified isn't found Yii will return "not
### Defaults
If user isn't specifying any route i.e. using URL like `http://example.com/`, Yii assumes that default route should be
used. It is determined by [[\yii\web\Application::defaultRoute]] method and is `site` by default meaning that `SiteController`
used. It is determined by [[yii\web\Application::defaultRoute]] method and is `site` by default meaning that `SiteController`
will be loaded.
A controller has a default action. When the user request does not specify which action to execute by using an URL such as
`http://example.com/?r=site`, the default action will be executed. By default, the default action is named as `index`.
It can be changed by setting the [[\yii\base\Controller::defaultAction]] property.
It can be changed by setting the [[yii\base\Controller::defaultAction]] property.
Action parameters
-----------------
......
......@@ -53,7 +53,7 @@ After the connection component is configured you can access it using the followi
$connection = \Yii::$app->db;
```
You can refer to [[\yii\db\Connection]] for a list of properties you can configure. Also note that you can define more
You can refer to [[yii\db\Connection]] for a list of properties you can configure. Also note that you can define more
than one connection component and use both at the same time if needed:
```php
......@@ -96,7 +96,7 @@ return [
Basic SQL queries
-----------------
Once you have a connection instance you can execute SQL queries using [[\yii\db\Command]].
Once you have a connection instance you can execute SQL queries using [[yii\db\Command]].
### SELECT
......@@ -173,8 +173,8 @@ $rowCount = $connection->createCommand($sql)->queryScalar();
In the code above `[[X]]` will be converted to properly quoted column name while `{{Y}}` will be converted to properly
quoted table name.
The alternative is to quote table and column names manually using [[\yii\db\Connection::quoteTableName()]] and
[[\yii\db\Connection::quoteColumnName()]]:
The alternative is to quote table and column names manually using [[yii\db\Connection::quoteTableName()]] and
[[yii\db\Connection::quoteColumnName()]]:
```php
$column = $connection->quoteColumnName($column);
......@@ -253,7 +253,7 @@ Working with database schema
### Getting schema information
You can get a [[\yii\db\Schema]] instance like the following:
You can get a [[yii\db\Schema]] instance like the following:
```php
$schema = $connection->getSchema();
......@@ -265,11 +265,11 @@ It contains a set of methods allowing you to retrieve various information about
$tables = $schema->getTableNames();
```
For the full reference check [[\yii\db\Schema]].
For the full reference check [[yii\db\Schema]].
### Modifying schema
Aside from basic SQL queries [[\yii\db\Command]] contains a set of methods allowing to modify database schema:
Aside from basic SQL queries [[yii\db\Command]] contains a set of methods allowing to modify database schema:
- createTable, renameTable, dropTable, truncateTable
- addColumn, renameColumn, dropColumn, alterColumn
......@@ -288,4 +288,4 @@ $connection->createCommand()->createTable('tbl_post', [
]);
```
For the full reference check [[\yii\db\Command]].
For the full reference check [[yii\db\Command]].
......@@ -40,7 +40,7 @@ $component->on($eventName, function($event) {
```
As shown in the anonymous function example, the event handling function must be defined so that it takes one argument.
This will be an [[\yii\base\Event]] object.
This will be an [[yii\base\Event]] object.
Removing Event Handlers
......
......@@ -2,7 +2,7 @@ Working with forms
==================
The primary way of using forms in Yii is through [[yii\widgets\ActiveForm]]. This approach should be preferred when
the form is based upon a model. Additionally, there are some useful methods in [[\yii\helpers\Html]] that are typically
the form is based upon a model. Additionally, there are some useful methods in [[yii\helpers\Html]] that are typically
used for adding buttons and help text to any form.
When creating model-based forms, the first step is to define the model itself. The model can be either based upon the
......
......@@ -8,8 +8,8 @@ because the potential users may be worldwide.
Locale and Language
-------------------
There are two languages defined in Yii application: [[\yii\base\Application::$sourceLanguage|source language]] and
[[\yii\base\Application::$language|target language]].
There are two languages defined in Yii application: [[yii\base\Application::$sourceLanguage|source language]] and
[[yii\base\Application::$language|target language]].
Source language is the language original application messages are written in such as:
......
......@@ -62,7 +62,7 @@ You may configure the targets in application configuration, like the following:
]
```
In the config above we are defining two log targets: [[\yii\log\FileTarget|file]] and [[\yii\log\EmailTarget|email]].
In the config above we are defining two log targets: [[yii\log\FileTarget|file]] and [[yii\log\EmailTarget|email]].
In both cases we are filtering messages handles by these targets by severity. In case of file target we're
additionally filter by category. `yii\*` means all categories starting with `yii\`.
......
......@@ -9,7 +9,7 @@ Yii models have the following basic features:
- Massive attribute assignment: the ability to populate multiple model attributes in one step.
- Scenario-based data validation.
Models in Yii extend from the [[\yii\base\Model]] class. Models are typically used to both hold data and define
Models in Yii extend from the [[yii\base\Model]] class. Models are typically used to both hold data and define
the validation rules for that data (aka, the business logic). The business logic greatly simplifies the generation
of models from complex web forms by providing validation and error reporting.
......@@ -31,7 +31,7 @@ echo $post->title;
echo $post->content;
```
Since [[\yii\base\Model|Model]] implements the [ArrayAccess](http://php.net/manual/en/class.arrayaccess.php) interface,
Since [[yii\base\Model|Model]] implements the [ArrayAccess](http://php.net/manual/en/class.arrayaccess.php) interface,
you can also access the attributes as if they were array elements:
```php
......@@ -42,7 +42,7 @@ echo $post['title'];
echo $post['content'];
```
By default, [[\yii\base\Model|Model]] requires that attributes be declared as *public* and *non-static*
By default, [[yii\base\Model|Model]] requires that attributes be declared as *public* and *non-static*
class member variables. In the following example, the `LoginForm` model class declares two attributes:
`username` and `password`.
......@@ -55,8 +55,8 @@ class LoginForm extends \yii\base\Model
}
```
Derived model classes may declare attributes in different ways, by overriding the [[\yii\base\Model::attributes()|attributes()]]
method. For example, [[\yii\db\ActiveRecord]] defines attributes using the column names of the database table
Derived model classes may declare attributes in different ways, by overriding the [[yii\base\Model::attributes()|attributes()]]
method. For example, [[yii\db\ActiveRecord]] defines attributes using the column names of the database table
that is associated with the class.
......@@ -65,12 +65,12 @@ Attribute Labels
Attribute labels are mainly used for display purpose. For example, given an attribute `firstName`, we can declare
a label `First Name` that is more user-friendly when displayed to end users in places such as form labels and
error messages. Given an attribute name, you can obtain its label by calling [[\yii\base\Model::getAttributeLabel()]].
error messages. Given an attribute name, you can obtain its label by calling [[yii\base\Model::getAttributeLabel()]].
To declare attribute labels, override the [[\yii\base\Model::attributeLabels()]] method. The overridden method returns
To declare attribute labels, override the [[yii\base\Model::attributeLabels()]] method. The overridden method returns
a mapping of attribute names to attribute labels, as shown in the example below. If an attribute is not found
in this mapping, its label will be generated using the [[\yii\base\Model::generateAttributeLabel()]] method.
In many cases, [[\yii\base\Model::generateAttributeLabel()]] will generate reasonable labels (e.g. `username` to `Username`,
in this mapping, its label will be generated using the [[yii\base\Model::generateAttributeLabel()]] method.
In many cases, [[yii\base\Model::generateAttributeLabel()]] will generate reasonable labels (e.g. `username` to `Username`,
`orderNumber` to `Order Number`).
```php
......@@ -200,7 +200,7 @@ if ($model->validate()) {
The possible validation rules for a model should be listed in its `rules()` method. Each validation rule applies to one
or several attributes and is effective in one or several scenarios. A rule can be specified using a validator object - an
instance of a [[\yii\validators\Validator]] child class, or an array with the following format:
instance of a [[yii\validators\Validator]] child class, or an array with the following format:
```php
[
......@@ -449,4 +449,4 @@ See also
--------
- [Model validation reference](validation.md)
- [[\yii\base\Model]]
- [[yii\base\Model]]
......@@ -137,7 +137,7 @@ sending either `ETag` or `Last-Modified` header in your application response. If
HTTP specification (most browsers are), content will be fetched only if it is different from what it was prevously.
Forming proper headers is time consuming task so Yii provides a shortcut in form of controller filter
[[\yii\web\HttpCache]]. Using it is very easy. In a controller you need to implement `behaviors` method like
[[yii\web\HttpCache]]. Using it is very easy. In a controller you need to implement `behaviors` method like
the following:
```php
......
......@@ -205,8 +205,8 @@ In this way you will avoid collision of fixture data files between tests and use
> Note: In the example above fixture files are named only for example purpose. In real life you should name them
> according to which fixture class your fixture classes are extending from. For example, if you are extending
> from [[\yii\test\ActiveFixture]] for DB fixtures, you should use DB table names as the fixture data file names;
> If you are extending for [[\yii\mongodb\ActiveFixture]] for MongoDB fixtures, you should use collection names as the file names.
> from [[yii\test\ActiveFixture]] for DB fixtures, you should use DB table names as the fixture data file names;
> If you are extending for [[yii\mongodb\ActiveFixture]] for MongoDB fixtures, you should use collection names as the file names.
The similar hierarchy can be used to organize fixture class files. Instead of using `data` as the root directory, you may
want to use `fixtures` as the root directory to avoid conflict with the data files.
......
......@@ -192,10 +192,10 @@ return [
### Handling REST requests
TBD:
- RESTful routing: [[\yii\web\VerbFilter]], [[\yii\web\UrlManager::$rules]]
- RESTful routing: [[yii\web\VerbFilter]], [[yii\web\UrlManager::$rules]]
- Json API:
- response: [[\yii\web\Response::format]]
- request: [[yii\web\Request::$parsers]], [[\yii\web\JsonParser]]
- response: [[yii\web\Response::format]]
- request: [[yii\web\Request::$parsers]], [[yii\web\JsonParser]]
URL parsing
......@@ -222,13 +222,13 @@ return [
Creating your own rule classes
------------------------------
[[\yii\web\UrlRule]] class is used for both parsing URL into parameters and creating URL based on parameters. Despite
[[yii\web\UrlRule]] class is used for both parsing URL into parameters and creating URL based on parameters. Despite
the fact that default implementation is flexible enough for the majority of projects, there are situations when using
your own rule class is the best choice. For example, in a car dealer website, we may want to support the URL format like
`/Manufacturer/Model`, where `Manufacturer` and `Model` must both match some data in a database table. The default rule
class will not work because it mostly relies on statically declared regular expressions which have no database knowledge.
We can write a new URL rule class by extending from [[\yii\web\UrlRule]] and use it in one or multiple URL rules. Using
We can write a new URL rule class by extending from [[yii\web\UrlRule]] and use it in one or multiple URL rules. Using
the above car dealer website as an example, we may declare the following URL rules in application config:
```php
......
......@@ -166,7 +166,7 @@ Validates that the attribute value is of certain length.
- `length` specifies the length limit of the value to be validated. Can be `exactly X`, `[min X]`, `[min X, max Y]`.
- `max` maximum length. If not set, it means no maximum length limit.
- `min` minimum length. If not set, it means no minimum length limit.
- `encoding` the encoding of the string value to be validated. _([[\yii\base\Application::charset]])_
- `encoding` the encoding of the string value to be validated. _([[yii\base\Application::charset]])_
### `unique`: [[yii\validators\UniqueValidator|UniqueValidator]]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment