Browse Source

Merge branch 'master' into doc

tags/2.0.16
cuiliang 7 years ago committed by GitHub
parent
commit
3dc949ed15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      docs/guide-ja/start-prerequisites.md
  2. 2
      docs/guide-ru/db-query-builder.md
  3. 2
      docs/guide-ru/input-forms.md
  4. 2
      docs/guide-ru/tutorial-yii-as-micro-framework.md
  5. 2
      docs/guide-zh-CN/concept-di-container.md
  6. 5
      docs/guide-zh-CN/runtime-routing.md
  7. 20
      docs/guide/README.md
  8. 4
      docs/guide/input-validation.md
  9. 2
      docs/guide/intro-upgrade-from-v1.md
  10. 2
      docs/guide/security-authorization.md
  11. 4
      docs/guide/start-databases.md
  12. 6
      docs/guide/start-gii.md
  13. 2
      docs/guide/start-looking-ahead.md
  14. 5
      docs/guide/start-prerequisites.md
  15. 4
      docs/guide/structure-application-components.md
  16. 2
      framework/CHANGELOG.md
  17. 2
      framework/base/Controller.php
  18. 3
      framework/db/oci/conditions/InConditionBuilder.php
  19. 2
      framework/helpers/BaseInflector.php

7
docs/guide-ja/start-prerequisites.md

@ -1,10 +1,12 @@
# 何を知っている必要があるか
Yii の学習曲線は他の PHP フレームワークほど急峻ではありませんが、それでもいくつかは事前に必要とされる知識があります。
Yii の学習曲線は他の PHP フレームワークほど急峻ではありませんが、それでも Yii を使い始める前に学習すべき事がいくつかはあります。
## PHP
Yii は PHP フレームワークですから、必ず [言語リファレンスを読んで理解する](http://php.net/manual/ja/langref.php) ようにして下さい。
Yii を使って開発するときはオブジェクト指向でコードを書くことになりますから、必ず、
[クラスとオブジェクト](https://secure.php.net/manual/ja/language.oop5.basic.php) および [名前空間](https://secure.php.net/manual/ja/language.namespaces.php) には慣れ親しんでおいて下さい。
## オブジェクト指向プログラミング
@ -15,6 +17,7 @@ Yii は PHP フレームワークですから、必ず [言語リファレンス
## コマンドラインと Composer
Yii は業界標準の PHP パッケージ管理ソフトである [Composer](https://getcomposer.org/) を広範囲に使用していますので、必ずそのガイドを読んで理解して下さい。
Yii は業界標準の PHP パッケージ管理ソフトである [Composer](https://getcomposer.org/) を広範囲に使用していますので、
必ずその [ガイド](https://getcomposer.org/doc/01-basic-usage.md) を読んで理解して下さい。
あなたがコマンドラインの使用に慣れていないのであれば、今こそ使い始めてみるべき時です。
いったん基礎を学習すれば、二度とコマンドラインなしで仕事をしようとは思わなくなりますよ。

2
docs/guide-ru/db-query-builder.md

@ -215,7 +215,7 @@ $userQuery = (new Query())->select('id')->from('user');
$query->where(['id' => $userQuery]);
```
Используя формат массива, Yii автоматически призяывает значения массива как параметры, потому в отличие от [строкового формата](#string-format),
Используя формат массива, Yii автоматически привязывает значения массива как параметры, потому в отличие от [строкового формата](#string-format),
привязывать параметры вручную не требуется. Обратите внимание, что Yii никогда НЕ экранирует имена столбцов (ключи массива),
потому если вы используете как ключ массива переменню, полученную от пользователя без дополнительной проверки, ваше приложение
становится подверженным атаке через SQL инъекцию. Чтобы избежать этого, используйте для имён столбцов только проверененные данные,

2
docs/guide-ru/input-forms.md

@ -161,7 +161,7 @@ Pjax::end();
В `jQuery.serializeArray()` имеются определённые проблемы
[при работе с файлами](https://github.com/jquery/jquery/issues/2321) и
[значениями кнопом типа submit](https://github.com/jquery/jquery/issues/2321).
[значениями кнопок типа submit](https://github.com/jquery/jquery/issues/2321).
Они не будут исправлены и признаны устаревшими в пользу класса`FormData` из HTML5.
Это означет, что поддержка файлов и значений submit-кнопок через AJAX или виджет

2
docs/guide-ru/tutorial-yii-as-micro-framework.md

@ -31,7 +31,7 @@ cd micro-app
}
```
Сохраните файл и запустите команду `comper install`. Это установит framework со всеми его зависимостями.
Сохраните файл и запустите команду `composer install`. Это установит framework со всеми его зависимостями.
## Создание структуры проекта

2
docs/guide-zh-CN/concept-di-container.md

@ -373,7 +373,7 @@ class HotelController extends Controller
的实例就会被创建并被作为第三个参数注入到控制器的构造器中。
高级实用性(Advanced Practical Usage) <span id="advanced-practical-usage"></span>
-----------------------------------
------------------------------------
比如说我们在 API 应用方面工作:

5
docs/guide-zh-CN/runtime-routing.md

@ -1,7 +1,7 @@
路由
=======
当[入口脚本](structure-entry-scripts.md)在调用 [[yii\web\Application::run()|run()]]
当[入口脚本](structure-entry-scripts.md)在调用 [[yii\web\Application::run()|run()]]
方法时,它进行的第一个操作就是解析输入的请求,然后实例化对应的[控制器动作](structure-controllers.md)处理这个请求。
该过程就被称为*引导路由(routing)*。
路由相反的操作会将给定的路由和参数生成一个可访问的URL地址,
@ -438,6 +438,9 @@ echo Url::previous();
> Note: 如果 [[yii\web\UrlRule::$pattern|pattern]] 中只存在可选参数和 `/`,只有所有参数被忽略时第一个参数才被忽略。
> Note: If [[yii\web\UrlRule::$pattern|pattern]] contains only optional parameters and slashes, first parameter could be omitted
only if all other parameters are omitted.
### 带服务名称的规则 <span id="rules-with-server-names"></span>

20
docs/guide/README.md

@ -75,11 +75,11 @@ Key Concepts
Working with Databases
----------------------
* [Data Access Objects](db-dao.md): Connecting to a database, basic queries, transactions, and schema manipulation
* [Database Access Objects](db-dao.md): Connecting to a database, basic queries, transactions, and schema manipulation
* [Query Builder](db-query-builder.md): Querying the database using a simple abstraction layer
* [Active Record](db-active-record.md): The Active Record ORM, retrieving and manipulating records, and defining relations
* [Migrations](db-migrations.md): Apply version control to your databases in a team development environment
* [Sphinx](https://yiiframework.com/extension/yiisoft/yii2-sphinx/doc/guide)
* [Sphinx](https://www.yiiframework.com/extension/yiisoft/yii2-sphinx/doc/guide)
* [Redis](https://www.yiiframework.com/extension/yiisoft/yii2-redis/doc/guide)
* [MongoDB](https://www.yiiframework.com/extension/yiisoft/yii2-mongodb/doc/guide)
* [ElasticSearch](https://www.yiiframework.com/extension/yiisoft/yii2-elasticsearch/doc/guide)
@ -183,14 +183,14 @@ Special Topics
Widgets
-------
* [GridView](http://www.yiiframework.com/doc-2.0/yii-grid-gridview.html)
* [ListView](http://www.yiiframework.com/doc-2.0/yii-widgets-listview.html)
* [DetailView](http://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html)
* [ActiveForm](http://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform)
* [Pjax](http://www.yiiframework.com/doc-2.0/yii-widgets-pjax.html)
* [Menu](http://www.yiiframework.com/doc-2.0/yii-widgets-menu.html)
* [LinkPager](http://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html)
* [LinkSorter](http://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html)
* [[yii\grid\GridView|GridView]]
* [[yii\widgets\ListView|ListView]]
* [[yii\widgets\DetailView|DetailView]]
* [[yii\widgets\ActiveForm|ActiveForm]]
* [[yii\widgets\Pjax|Pjax]]
* [[yii\widgets\Menu|Menu]]
* [[yii\widgets\LinkPager|LinkPager]]
* [[yii\widgets\LinkSorter|LinkSorter]]
* [Bootstrap Widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide)
* [jQuery UI Widgets](https://www.yiiframework.com/extension/yiisoft/yii2-jui/doc/guide)

4
docs/guide/input-validation.md

@ -294,7 +294,7 @@ which supports declaring both attributes and rules on the fly. Its usage is like
```php
public function actionSearch($name, $email)
{
$model = DynamicModel::validateData(compact('name', 'email'), [
$model = DynamicModel::validateData(['name' => $name, 'email' => $email]), [
[['name', 'email'], 'string', 'max' => 128],
['email', 'email'],
]);
@ -316,7 +316,7 @@ Alternatively, you may use the following more "classic" syntax to perform ad hoc
```php
public function actionSearch($name, $email)
{
$model = new DynamicModel(compact('name', 'email'));
$model = new DynamicModel(['name' => $name, 'email' => $email]);
$model->addRule(['name', 'email'], 'string', ['max' => 128])
->addRule('email', 'email')
->validate();

2
docs/guide/intro-upgrade-from-v1.md

@ -505,7 +505,7 @@ The `CWebUser` class in 1.1 is now replaced by [[yii\web\User]], and there is no
`CUserIdentity` class. Instead, you should implement the [[yii\web\IdentityInterface]] which
is much more straightforward to use. The advanced project template provides such an example.
Please refer to the [Authentication](security-authentication.md), [Authorization](security-authorization.md), and [Advanced Project Template](https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/README.md) sections for more details.
Please refer to the [Authentication](security-authentication.md), [Authorization](security-authorization.md), and [Advanced Project Template](https://www.yiiframework.com/extension/yiisoft/yii2-app-advanced/doc/guide) sections for more details.
URL Management

2
docs/guide/security-authorization.md

@ -599,7 +599,7 @@ If the creation of role parameters is a simple operation, you may just specify a
'allow' => true,
'actions' => ['update'],
'roles' => ['updatePost'],
'roleParams' => ['postId' => Yii::$app->request->get('id')];
'roleParams' => ['postId' => Yii::$app->request->get('id')],
],
```

4
docs/guide/start-databases.md

@ -129,7 +129,7 @@ $country->save();
```
> Info: Active Record is a powerful way to access and manipulate database data in an object-oriented fashion.
You may find more detailed information in the [Active Record](db-active-record.md) section. Alternatively, you may also interact with a database using a lower-level data accessing method called [Data Access Objects](db-dao.md).
You may find more detailed information in the [Active Record](db-active-record.md) section. Alternatively, you may also interact with a database using a lower-level data accessing method called [Database Access Objects](db-dao.md).
Creating an Action <span id="creating-action"></span>
@ -257,7 +257,7 @@ Summary <span id="summary"></span>
In this section, you learned how to work with a database. You also learned how to fetch and display
data in pages with the help of [[yii\data\Pagination]] and [[yii\widgets\LinkPager]].
In the next section, you will learn how to use the powerful code generation tool, called [Gii](https://github.com/yiisoft/yii2-gii/blob/master/docs/guide/README.md),
In the next section, you will learn how to use the powerful code generation tool, called [Gii](https://www.yiiframework.com/extension/yiisoft/yii2-gii/doc/guide),
to help you rapidly implement some commonly required features, such as the Create-Read-Update-Delete (CRUD)
operations for working with the data in a database table. As a matter of fact, the code you have just written can all
be automatically generated in Yii using the Gii tool.

6
docs/guide/start-gii.md

@ -1,7 +1,7 @@
Generating Code with Gii
========================
This section will describe how to use [Gii](https://github.com/yiisoft/yii2-gii/blob/master/docs/guide/README.md) to automatically generate code
This section will describe how to use [Gii](https://www.yiiframework.com/extension/yiisoft/yii2-gii/doc/guide) to automatically generate code
that implements some common Web site features. Using Gii to auto-generate code is simply a matter of entering the right information per the instructions shown on the Gii Web pages.
Through this tutorial, you will learn how to:
@ -15,7 +15,7 @@ Through this tutorial, you will learn how to:
Starting Gii <span id="starting-gii"></span>
------------
[Gii](https://github.com/yiisoft/yii2-gii/blob/master/docs/guide/README.md) is provided in Yii as a [module](structure-modules.md). You can enable Gii
[Gii](https://www.yiiframework.com/extension/yiisoft/yii2-gii/doc/guide) is provided in Yii as a [module](structure-modules.md). You can enable Gii
by configuring it in the [[yii\base\Application::modules|modules]] property of the application. Depending upon how you created your application, you may find the following code is already provided in the `config/web.php` configuration file:
```php
@ -129,7 +129,7 @@ or to customize them:
> Info: Gii is designed to be a highly customizable and extensible code generation tool. Using it wisely
can greatly accelerate your application development speed. For more details, please refer to
the [Gii](https://github.com/yiisoft/yii2-gii/blob/master/docs/guide/README.md) section.
the [Gii](https://www.yiiframework.com/extension/yiisoft/yii2-gii/doc/guide) section.
Summary <span id="summary"></span>

2
docs/guide/start-looking-ahead.md

@ -3,7 +3,7 @@ Looking Ahead
If you've read through the entire "Getting Started" chapter, you have now created a complete Yii application. In the process, you have learned how to implement some commonly
needed features, such as getting data from users via an HTML form, fetching data from a database, and
displaying data in a paginated fashion. You have also learned how to use [Gii](https://github.com/yiisoft/yii2-gii/blob/master/docs/guide/README.md) to generate
displaying data in a paginated fashion. You have also learned how to use [Gii](https://www.yiiframework.com/extension/yiisoft/yii2-gii/doc/guide) to generate
code automatically. Using Gii for code generation turns the bulk of your Web development process into a task as simple as just filling out some forms.
This section will summarize the Yii resources available to help you be more productive when using the framework.

5
docs/guide/start-prerequisites.md

@ -1,10 +1,11 @@
# What do you need to know
Yii learning curve is not as steep as other PHP frameworks but still it requires some beforehand knowledge.
The Yii learning curve is not as steep as other PHP frameworks but still there are some things you should learn before starting with Yii.
## PHP
Yii is a PHP framework so make sure you [read and understand language reference](http://php.net/manual/en/langref.php).
When developing with Yii you will be writing code in an object oriented fashion, so make sure you are familiar with [Classes and Objects](https://secure.php.net/manual/en/language.oop5.basic.php) as well as [namespaces](https://secure.php.net/manual/en/language.namespaces.php).
## Object oriented programming
@ -17,6 +18,6 @@ manage that complexity.
## Command line and composer
Yii extensively uses de-facto standard PHP package manager, [Composer](https://getcomposer.org/) so make sure you read
and understand its guide. If you are not familiar with using command line it is time to start trying. Once you
and understand its [guide](https://getcomposer.org/doc/01-basic-usage.md). If you are not familiar with using command line it is time to start trying. Once you
learn the basics you'll never want to work without it.

4
docs/guide/structure-application-components.md

@ -97,11 +97,11 @@ like you do with normal application components. When you are configuring a core
if you do not specify its class, the default one will be used.
* [[yii\web\AssetManager|assetManager]]: manages asset bundles and asset publishing.
Please refer to the [Managing Assets](structure-assets.md) section for more details.
Please refer to the [Assets](structure-assets.md) section for more details.
* [[yii\db\Connection|db]]: represents a database connection through which you can perform DB queries.
Note that when you configure this component, you must specify the component class as well as other required
component properties, such as [[yii\db\Connection::dsn]].
Please refer to the [Data Access Objects](db-dao.md) section for more details.
Please refer to the [Database Access Objects](db-dao.md) section for more details.
* [[yii\base\Application::errorHandler|errorHandler]]: handles PHP errors and exceptions.
Please refer to the [Handling Errors](runtime-handling-errors.md) section for more details.
* [[yii\i18n\Formatter|formatter]]: formats data when they are displayed to end users. For example, a number

2
framework/CHANGELOG.md

@ -9,6 +9,8 @@ Yii Framework 2 Change Log
- Bug #14660: Fixed `yii\caching\DbCache` concurrency issue when set values with the same key (rugabarbo)
- Bug #15988: Fixed bash completion (alekciy)
- Bug #15117: Fixed `yii\db\Schema::getTableMetadata` cache refreshing (boboldehampsink)
- Bug #16073: Fixed regression in Oracle `IN` condition builder for more than 1000 items (cebe)
2.0.15.1 March 21, 2018
-----------------------

2
framework/base/Controller.php

@ -226,7 +226,7 @@ class Controller extends Component implements ViewContextInterface
if (isset($actionMap[$id])) {
return Yii::createObject($actionMap[$id], [$id, $this]);
} elseif (preg_match('/^[a-z0-9\\-_]+$/', $id) && strpos($id, '--') === false && trim($id, '-') === $id) {
$methodName = 'action' . str_replace(' ', '', ucwords(implode(' ', explode('-', $id))));
$methodName = 'action' . str_replace(' ', '', ucwords(str_replace('-', ' ', $id)));
if (method_exists($this, $methodName)) {
$method = new \ReflectionMethod($this, $methodName);
if ($method->isPublic() && $method->getName() === $methodName) {

3
framework/db/oci/conditions/InConditionBuilder.php

@ -65,7 +65,8 @@ class InConditionBuilder extends \yii\db\conditions\InConditionBuilder
for ($i = 0; $i < $count; $i += $maxParameters) {
$slices[] = $this->queryBuilder->createConditionFromArray([$operator, $column, array_slice($values, $i, $maxParameters)]);
}
array_unshift($slices, ($operator === 'IN') ? 'OR' : 'AND');
return $this->queryBuilder->buildCondition([($operator === 'IN') ? 'OR' : 'AND', $slices], $params);
return $this->queryBuilder->buildCondition($slices, $params);
}
}

2
framework/helpers/BaseInflector.php

@ -407,7 +407,7 @@ class BaseInflector
*/
public static function id2camel($id, $separator = '-')
{
return str_replace(' ', '', ucwords(implode(' ', explode($separator, $id))));
return str_replace(' ', '', ucwords(str_replace($separator, ' ', $id)));
}
/**

Loading…
Cancel
Save