Skip to content

Commit 8bf9184

Browse files
committed
edited the guid. fixed a huge bunch of links, hopefully all :)
1 parent 3846e5c commit 8bf9184

21 files changed

+274
-215
lines changed

docs/guide/active-record.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,8 @@ $order->subtotal = 100;
506506
$customer->link('orders', $order);
507507
```
508508

509-
The [[yii\db\Activerecord::link()|link()]] call above will set the `customer_id` of the order to be the primary key
510-
value of `$customer` and then call [[yii\db\Activerecord::save()|save()]] to save the order into database.
509+
The [[yii\db\ActiveRecord::link()|link()]] call above will set the `customer_id` of the order to be the primary key
510+
value of `$customer` and then call [[yii\db\ActiveRecord::save()|save()]] to save the order into database.
511511

512512

513513
Life Cycles of an ActiveRecord Object
@@ -520,33 +520,33 @@ method overriding and event handling mechanisms.
520520
When instantiating a new ActiveRecord instance, we will have the following life cycles:
521521

522522
1. constructor
523-
2. [[yii\db\Activerecord::init()|init()]]: will trigger an [[yii\db\Activerecord::EVENT_INIT|EVENT_INIT]] event
523+
2. [[yii\db\ActiveRecord::init()|init()]]: will trigger an [[yii\db\ActiveRecord::EVENT_INIT|EVENT_INIT]] event
524524

525-
When getting an ActiveRecord instance through the [[yii\db\Activerecord::find()|find()]] method, we will have the following life cycles:
525+
When getting an ActiveRecord instance through the [[yii\db\ActiveRecord::find()|find()]] method, we will have the following life cycles:
526526

527527
1. constructor
528-
2. [[yii\db\Activerecord::init()|init()]]: will trigger an [[yii\db\Activerecord::EVENT_INIT|EVENT_INIT]] event
529-
3. [[yii\db\Activerecord::afterFind()|afterFind()]]: will trigger an [[yii\db\Activerecord::EVENT_AFTER_FIND|EVENT_AFTER_FIND]] event
528+
2. [[yii\db\ActiveRecord::init()|init()]]: will trigger an [[yii\db\ActiveRecord::EVENT_INIT|EVENT_INIT]] event
529+
3. [[yii\db\ActiveRecord::afterFind()|afterFind()]]: will trigger an [[yii\db\ActiveRecord::EVENT_AFTER_FIND|EVENT_AFTER_FIND]] event
530530

531-
When calling [[yii\db\Activerecord::save()|save()]] to insert or update an ActiveRecord, we will have the following life cycles:
531+
When calling [[yii\db\ActiveRecord::save()|save()]] to insert or update an ActiveRecord, we will have the following life cycles:
532532

533-
1. [[yii\db\Activerecord::beforeValidate()|beforeValidate()]]: will trigger an [[yii\db\Activerecord::EVENT_BEFORE_VALIDATE|EVENT_BEFORE_VALIDATE]] event
534-
2. [[yii\db\Activerecord::afterValidate()|afterValidate()]]: will trigger an [[yii\db\Activerecord::EVENT_AFTER_VALIDATE|EVENT_AFTER_VALIDATE]] event
535-
3. [[yii\db\Activerecord::beforeSave()|beforeSave()]]: will trigger an [[yii\db\Activerecord::EVENT_BEFORE_INSERT|EVENT_BEFORE_INSERT]] or [[yii\db\Activerecord::EVENT_BEFORE_UPDATE|EVENT_BEFORE_UPDATE]] event
533+
1. [[yii\db\ActiveRecord::beforeValidate()|beforeValidate()]]: will trigger an [[yii\db\ActiveRecord::EVENT_BEFORE_VALIDATE|EVENT_BEFORE_VALIDATE]] event
534+
2. [[yii\db\ActiveRecord::afterValidate()|afterValidate()]]: will trigger an [[yii\db\ActiveRecord::EVENT_AFTER_VALIDATE|EVENT_AFTER_VALIDATE]] event
535+
3. [[yii\db\ActiveRecord::beforeSave()|beforeSave()]]: will trigger an [[yii\db\ActiveRecord::EVENT_BEFORE_INSERT|EVENT_BEFORE_INSERT]] or [[yii\db\ActiveRecord::EVENT_BEFORE_UPDATE|EVENT_BEFORE_UPDATE]] event
536536
4. perform the actual data insertion or updating
537-
5. [[yii\db\Activerecord::afterSave()|afterSave()]]: will trigger an [[yii\db\Activerecord::EVENT_AFTER_INSERT|EVENT_AFTER_INSERT]] or [[yii\db\Activerecord::EVENT_AFTER_UPDATE|EVENT_AFTER_UPDATE]] event
537+
5. [[yii\db\ActiveRecord::afterSave()|afterSave()]]: will trigger an [[yii\db\ActiveRecord::EVENT_AFTER_INSERT|EVENT_AFTER_INSERT]] or [[yii\db\ActiveRecord::EVENT_AFTER_UPDATE|EVENT_AFTER_UPDATE]] event
538538

539-
Finally when calling [[yii\db\Activerecord::delete()|delete()]] to delete an ActiveRecord, we will have the following life cycles:
539+
Finally when calling [[yii\db\ActiveRecord::delete()|delete()]] to delete an ActiveRecord, we will have the following life cycles:
540540

541-
1. [[yii\db\Activerecord::beforeDelete()|beforeDelete()]]: will trigger an [[yii\db\Activerecord::EVENT_BEFORE_DELETE|EVENT_BEFORE_DELETE]] event
541+
1. [[yii\db\ActiveRecord::beforeDelete()|beforeDelete()]]: will trigger an [[yii\db\ActiveRecord::EVENT_BEFORE_DELETE|EVENT_BEFORE_DELETE]] event
542542
2. perform the actual data deletion
543-
3. [[yii\db\Activerecord::afterDelete()|afterDelete()]]: will trigger an [[yii\db\Activerecord::EVENT_AFTER_DELETE|EVENT_AFTER_DELETE]] event
543+
3. [[yii\db\ActiveRecord::afterDelete()|afterDelete()]]: will trigger an [[yii\db\ActiveRecord::EVENT_AFTER_DELETE|EVENT_AFTER_DELETE]] event
544544

545545

546546
Custom scopes
547547
-------------
548548

549-
When [[yii\db\Activerecord::find()|find()]] or [[yii\db\Activerecord::findBySql()|findBySql()]] Active Record method is being called without parameters it returns an [[yii\db\Activerecord::yii\db\ActiveQuery|yii\db\ActiveQuery]]
549+
When [[yii\db\ActiveRecord::find()|find()]] or [[yii\db\ActiveRecord::findBySql()|findBySql()]] Active Record method is being called without parameters it returns an [[yii\db\ActiveRecord::yii\db\ActiveQuery|yii\db\ActiveQuery]]
550550
instance. This object holds all the parameters and conditions for a future query and also allows you to customize these
551551
using a set of methods that are called scopes. By default there is a good set of such methods some of which we've
552552
already used above: `where`, `orderBy`, `limit` etc.
@@ -657,8 +657,8 @@ When a few DB operations are related and are executed
657657
TODO: FIXME: WIP, TBD, https://github.com/yiisoft/yii2/issues/226
658658

659659
,
660-
[[yii\db\Activerecord::afterSave()|afterSave()]], [[yii\db\Activerecord::beforeDelete()|beforeDelete()]] and/or [[yii\db\Activerecord::afterDelete()|afterDelete()]] life cycle methods. Developer may come
661-
to the solution of overriding ActiveRecord [[yii\db\Activerecord::save()|save()]] method with database transaction wrapping or
660+
[[yii\db\ActiveRecord::afterSave()|afterSave()]], [[yii\db\ActiveRecord::beforeDelete()|beforeDelete()]] and/or [[yii\db\ActiveRecord::afterDelete()|afterDelete()]] life cycle methods. Developer may come
661+
to the solution of overriding ActiveRecord [[yii\db\ActiveRecord::save()|save()]] method with database transaction wrapping or
662662
even using transaction in controller action, which is strictly speaking doesn't seem to be a good
663663
practice (recall "skinny-controller / fat-model" fundamental rule).
664664

@@ -686,7 +686,7 @@ class Product extends \yii\db\ActiveRecord
686686
}
687687
```
688688

689-
Overriding [[yii\db\Activerecord::save()|save()]] method:
689+
Overriding [[yii\db\ActiveRecord::save()|save()]] method:
690690

691691
```php
692692

docs/guide/assets.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ Managing assets
22
===============
33

44
An asset in Yii is a file that is included into the page. It could be CSS, JavaScript or
5-
any other file. Framework provides many ways to work with assets from basics such as adding `<script src="` tag
5+
any other file. Framework provides many ways to work with assets from basics such as adding `<script src="...">` tag
66
for a file that is [handled by View](view.md) section to advanced usage such as publishing files that are not
7-
under webserve document root, resolving JavaScript dependencies or minifying CSS.
7+
under the webservers document root, resolving JavaScript dependencies or minifying CSS.
88

99
Declaring asset bundle
1010
----------------------
@@ -13,9 +13,15 @@ In order to publish some assets you should declare an asset bundle first. The bu
1313
directories to be published and their dependencies on other asset bundles.
1414

1515
Both basic and advanced application templates contain `AppAsset` asset bundle class that defines assets required
16-
application wide. Let's review basic application asset bundle class:
16+
application wide. An asset bundle class always extends from [[yii\web\AssetBundle]].
17+
18+
Let's review basic application's asset bundle class:
1719

1820
```php
21+
<?php
22+
23+
use yii\web\AssetBundle as AssetBundle;
24+
1925
class AppAsset extends AssetBundle
2026
{
2127
public $basePath = '@webroot';

docs/guide/authorization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function behaviors()
209209
}
210210
```
211211

212-
Another way is to call [[User::checkAccess()]] where appropriate.
212+
Another way is to call [[yii\web\User::checkAccess()]] where appropriate.
213213

214214
### Using DB-based storage for RBAC
215215

docs/guide/basics.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@ Basic concepts of Yii
55
Component and Object
66
--------------------
77

8-
Classes of the Yii framework usually extend from one of the two base classes [[Object]] and [[Component]].
8+
Classes of the Yii framework usually extend from one of the two base classes [[yii\base\Object]] and [[yii\base\Component]].
99
These classes provide useful features that are added automatically to all classes extending from them.
1010

11-
The `Object` class provides the [configuration and property feature](../api/base/Object.md).
12-
The `Component` class extends from `Object` and adds [event handling](events.md) and [behaviors](behaviors.md).
11+
The [[yii\base\Object|Object]] class provides the [configuration and property feature](../api/base/Object.md).
12+
The [[yii\base\Component|Component]] class extends from [[yii\base\Object|Object]] and adds
13+
[event handling](events.md) and [behaviors](behaviors.md).
1314

14-
`Object` is usually used for classes that represent basic data structures while `Component` is used for
15-
application components and other classes that implement higher logic.
15+
[[yii\base\Object|Object]] is usually used for classes that represent basic data structures while
16+
[[yii\base\Component|Component]] is used for application components and other classes that implement higher logic.
1617

1718

1819
Object Configuration
1920
--------------------
2021

21-
The [[Object]] class introduces a uniform way of configuring objects. Any descendant class
22-
of [[Object]] should declare its constructor (if needed) in the following way so that
22+
The [[yii\base\Object|Object]] class introduces a uniform way of configuring objects. Any descendant class
23+
of [[yii\base\Object|Object]] should declare its constructor (if needed) in the following way so that
2324
it can be properly configured:
2425

2526
```php

docs/guide/behaviors.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ code execution. Unlike [PHP's traits](http://www.php.net/traits), behaviors can
99
Using behaviors
1010
---------------
1111

12-
A behavior can be attached to any class that extends from `Component`. In order to attach a behavior to a class, the component class must implement the `behaviors`
13-
method. As an example, Yii provides the `AutoTimestamp` behavior for automatically updating timestamp fields when saving an Active Record model:
12+
A behavior can be attached to any class that extends from [[yii\base\Component]]. In order to attach a behavior to a class,
13+
the component class must implement the `behaviors`
14+
method. As an example, Yii provides the [[yii\behaviors\AutoTimestamp|AutoTimestamp]] behavior for automatically updating timestamp
15+
fields when saving an [[yii\db\ActiveRecord|Active Record]] model:
1416

1517
```php
1618
class User extends ActiveRecord
@@ -32,7 +34,10 @@ class User extends ActiveRecord
3234
}
3335
```
3436

35-
In the above, the `class` value is a string representing the fully qualified behavior class name. All of the other key-value pairs represent corresponding public properties of the `AutoTimestamp` class, thereby customizing how the behavior functions.
37+
In the above, the `class` value is a string representing the fully qualified behavior class name.
38+
All of the other key-value pairs represent corresponding public properties of the [[yii\behaviors\AutoTimestamp|AutoTimestamp]]
39+
class, thereby customizing how the behavior functions.
40+
3641

3742
Creating your own behaviors
3843
---------------------------

docs/guide/bootstrap-widgets.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,26 @@ Yii widgets
3333
Most complex bootstrap components are wrapped into Yii widgets to allow more robust syntax and integrate with
3434
framework features. All widgets belong to `\yii\bootstrap` namespace:
3535

36-
- Alert
37-
- Button
38-
- ButtonDropdown
39-
- ButtonGroup
40-
- Carousel
41-
- Collapse
42-
- Dropdown
43-
- Modal
44-
- Nav
45-
- NavBar
46-
- Progress
47-
- Tabs
36+
- [[yii\bootstrap\Alert|Alert]]
37+
- [[yii\bootstrap\Button|Button]]
38+
- [[yii\bootstrap\ButtonDropdown|ButtonDropdown]]
39+
- [[yii\bootstrap\ButtonGroup|ButtonGroup]]
40+
- [[yii\bootstrap\Carousel|Carousel]]
41+
- [[yii\bootstrap\Collapse|Collapse]]
42+
- [[yii\bootstrap\Dropdown|Dropdown]]
43+
- [[yii\bootstrap\Modal|Modal]]
44+
- [[yii\bootstrap\Nav|Nav]]
45+
- [[yii\bootstrap\NavBar|NavBar]]
46+
- [[yii\bootstrap\Progress|Progress]]
47+
- [[yii\bootstrap\Tabs|Tabs]]
4848

4949

5050
Using the .less files of Bootstrap directly
5151
-------------------------------------------
5252

5353
If you want to include the [Bootstrap css directly in your less files](http://getbootstrap.com/getting-started/#customizing)
5454
you may need to disable the original bootstrap css files to be loaded.
55-
You can do this by setting the css property of the `BootstrapAsset` to be empty.
55+
You can do this by setting the css property of the [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] to be empty.
5656
For this you need to configure the `assetManagner` application component as follows:
5757

5858
```php

docs/guide/caching.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ is a summary of the available cache components:
7373
[Zend Data Cache](http://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm)
7474
as the underlying caching medium.
7575

76-
Tip: because all these cache components extend from the same base class [[Cache]], one can switch to use
76+
Tip: because all these cache components extend from the same base class [[yii\caching\Cache]], one can switch to use
7777
a different type of cache without modifying the code that uses cache.
7878

7979
Caching can be used at different levels. At the lowest level, we use cache to store a single piece of data,
@@ -92,25 +92,25 @@ Data Caching
9292

9393
Data caching is about storing some PHP variable in cache and retrieving it later from cache. For this purpose,
9494
the cache component base class [[\yii\caching\Cache]] provides two methods that are used most of the time:
95-
[[set()]] and [[get()]]. Note, only serializable variables and objects could be cached successfully.
95+
[[yii\caching\Cache::set()|set()]] and [[yii\caching\Cache::get()|get()]]. Note, only serializable variables and objects could be cached successfully.
9696

97-
To store a variable `$value` in cache, we choose a unique `$key` and call [[set()]] to store it:
97+
To store a variable `$value` in cache, we choose a unique `$key` and call [[yii\caching\Cache::set()|set()]] to store it:
9898

9999
```php
100100
Yii::$app->cache->set($key, $value);
101101
```
102102

103103
The cached data will remain in the cache forever unless it is removed because of some caching policy
104104
(e.g. caching space is full and the oldest data are removed). To change this behavior, we can also supply
105-
an expiration parameter when calling [[set()]] so that the data will be removed from the cache after
105+
an expiration parameter when calling [[yii\caching\Cache::set()|set()]] so that the data will be removed from the cache after
106106
a certain period of time:
107107

108108
```php
109109
// keep the value in cache for at most 45 seconds
110110
Yii::$app->cache->set($key, $value, 45);
111111
```
112112

113-
Later when we need to access this variable (in either the same or a different web request), we call [[get()]]
113+
Later when we need to access this variable (in either the same or a different web request), we call [[yii\caching\Cache::get()|get()]]
114114
with the key to retrieve it from cache. If the value returned is `false`, it means the value is not available
115115
in cache and we should regenerate it:
116116

@@ -134,18 +134,20 @@ may be cached in the application. It is **NOT** required that the key is unique
134134
the cache component is intelligent enough to differentiate keys for different applications.
135135

136136
Some cache storages, such as MemCache, APC, support retrieving multiple cached values in a batch mode,
137-
which may reduce the overhead involved in retrieving cached data. A method named [[mget()]] is provided
137+
which may reduce the overhead involved in retrieving cached data. A method named [[yii\caching\Cache::mget()|mget()]] is provided
138138
to exploit this feature. In case the underlying cache storage does not support this feature,
139-
[[mget()]] will still simulate it.
139+
[[yii\caching\Cache::mget()|mget()]] will still simulate it.
140140

141-
To remove a cached value from cache, call [[delete()]]; and to remove everything from cache, call [[flush()]].
142-
Be very careful when calling [[flush()]] because it also removes cached data that are from other applications.
141+
To remove a cached value from cache, call [[yii\caching\Cache::delete()|delete()]]; and to remove everything from cache, call
142+
[[yii\caching\Cache::flush()|flush()]].
143+
Be very careful when calling [[yii\caching\Cache::flush()|flush()]] because it also removes cached data that are from
144+
other applications if the cache is shared among different applications.
143145

144-
Note, because [[Cache]] implements `ArrayAccess`, a cache component can be used liked an array. The followings
146+
Note, because [[yii\caching\Cache]] implements `ArrayAccess`, a cache component can be used liked an array. The followings
145147
are some examples:
146148

147149
```php
148-
$cache = Yii::$app->getComponent('cache');
150+
$cache = Yii::$app->cache;
149151
$cache['var1'] = $value1; // equivalent to: $cache->set('var1', $value1);
150152
$value2 = $cache['var2']; // equivalent to: $value2 = $cache->get('var2');
151153
```
@@ -157,10 +159,10 @@ are caching the content of some file and the file is changed, we should invalida
157159
content from the file instead of the cache.
158160

159161
We represent a dependency as an instance of [[\yii\caching\Dependency]] or its child class. We pass the dependency
160-
instance along with the data to be cached when calling `set()`.
162+
instance along with the data to be cached when calling [[yii\caching\Cache::set()|set()]].
161163

162164
```php
163-
use yii\cache\FileDependency;
165+
use yii\caching\FileDependency;
164166

165167
// the value will expire in 30 seconds
166168
// it may also be invalidated earlier if the dependent file is changed
@@ -172,12 +174,12 @@ get a false value, indicating the data needs to be regenerated.
172174

173175
Below is a summary of the available cache dependencies:
174176

175-
- [[\yii\cache\FileDependency]]: the dependency is changed if the file's last modification time is changed.
176-
- [[\yii\cache\GroupDependency]]: marks a cached data item with a group name. You may invalidate the cached data items
177-
with the same group name all at once by calling [[\yii\cache\GroupDependency::invalidate()]].
178-
- [[\yii\cache\DbDependency]]: the dependency is changed if the query result of the specified SQL statement is changed.
179-
- [[\yii\cache\ChainedDependency]]: the dependency is changed if any of the dependencies on the chain is changed.
180-
- [[\yii\cache\ExpressionDependency]]: the dependency is changed if the result of the specified PHP expression is
177+
- [[\yii\caching\FileDependency]]: the dependency is changed if the file's last modification time is changed.
178+
- [[\yii\caching\GroupDependency]]: marks a cached data item with a group name. You may invalidate the cached data items
179+
with the same group name all at once by calling [[\yii\caching\GroupDependency::invalidate()]].
180+
- [[\yii\caching\DbDependency]]: the dependency is changed if the query result of the specified SQL statement is changed.
181+
- [[\yii\caching\ChainedDependency]]: the dependency is changed if any of the dependencies on the chain is changed.
182+
- [[\yii\caching\ExpressionDependency]]: the dependency is changed if the result of the specified PHP expression is
181183
changed.
182184

183185
### Query Caching

docs/guide/console-migrate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ by Yii with the corresponding types depended on your database management system.
103103
You can use them to write database independent migrations.
104104
For example `pk` will be replaced by `int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY`
105105
for MySQL and `integer PRIMARY KEY AUTOINCREMENT NOT NULL` for sqlite.
106-
See documentation of [[QueryBuilder::getColumnType()]] for more details and a list
106+
See documentation of [[yii\db\QueryBuilder::getColumnType()]] for more details and a list
107107
of available types. You may also use the constants defined in [[\yii\db\Schema]] to
108108
define column types.
109109

0 commit comments

Comments
 (0)