Skip to content

Commit

Permalink
Merge branch 'master' into 93-relational-beforefind-criteria-modifica…
Browse files Browse the repository at this point in the history
…tion

* master: (180 commits)
  Updated changelog with last-modified date change.
  Changed the CHttpCacheFilter to use RFC 1123 complaint dates when returning the last-modified header.
  tabs...
  gii: better default validation "length" rule for fixed-point / floating-point field type (MYSQL)
  fixes #1319
  updated comment in CHttpSession
  Update framework/YiiBase.php
  Update docs/guide/database.arr.txt
  New unit test for enhanced $gCProbability s/getters in CHttpSession #486. Fixed those methods to process corner cases properly. Initial $gCProbability is now double(1.0), was > 1.0 before.
  Bug #112: MSSQL: database abstraction layer now uses native transaction support of the SQLSRV driver.
  Forgot about spaces in comments creating procedure call. [ci skip]
  Better comments testing method name.
  Forgot about local MSSQL database settings.
  MSSQL unit testing SQL file reformatted and decorated. MSSQL testing class improved. Added unit tests for column comments retrieving.
  Removed old message.
  Update docs/guide/topics.i18n.txt
  Update docs/guide/topics.i18n.txt
  Requirements checker: russian (ru_RU) messages.
  Minor fixes and refinements to the MSSQL unit tests.
  better fix for issues #124
  ...

Conflicts:
	UPGRADE
  • Loading branch information
cebe committed Sep 3, 2012
2 parents 21da317 + 2147fae commit be1fbf1
Show file tree
Hide file tree
Showing 205 changed files with 5,402 additions and 4,458 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ before_script:
- psql -q -c 'CREATE DATABASE yii WITH OWNER = test;' -U postgres - psql -q -c 'CREATE DATABASE yii WITH OWNER = test;' -U postgres
- psql -q -c 'GRANT ALL PRIVILEGES ON DATABASE yii TO test;' -U postgres - psql -q -c 'GRANT ALL PRIVILEGES ON DATABASE yii TO test;' -U postgres
- echo 'y' | pecl install memcache > ~/memcache.log || ( echo "=== MEMCACHE BUILD FAILED ==="; cat ~/memcache.log ) - echo 'y' | pecl install memcache > ~/memcache.log || ( echo "=== MEMCACHE BUILD FAILED ==="; cat ~/memcache.log )
- echo "extension=memcache.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` - if [ $TRAVIS_PHP_VERSION \< 5.4 ]; then echo "extension=memcache.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi


script: phpunit --colors --coverage-text --exclude-group mssql framework script: phpunit --colors --coverage-text --exclude-group mssql framework
34 changes: 31 additions & 3 deletions CHANGELOG
Original file line number Original file line Diff line number Diff line change
@@ -1,12 +1,40 @@
Yii Framework Change Log Yii Framework Change Log
======================== ========================


Version 1.1.12 work in progress Version 1.1.13 work in progress
------------------------------- -------------------------------
- Bug #1077: Fixed the problem with alias in CSort (creocoder) - Bug #112: MSSQL: database abstraction layer now uses native transaction support of the SQLSRV driver (resurtm)
- Bug #124: Added CMysqlCommandBuilder to handle JOIN directive on update commands correctly (cebe, DaSourcerer)
- Enh #486: CHttpSession::$gCProbability and CDbHttpSession::$gCProbability are floats now. Minimal possible $gCProbability value has been changed to the ≈0.00000005% (1/2147483647), was integer 1% before, default value left unchanged (1%) (resurtm)
- Enh #556: CDbColumnSchema::$comment property has been added. It stores comment for the table column, comment retrieving is working for MySQL, PgSQL and Oracle (resurtm)
- Enh #1289: Added support for column comments for MSSQL (CDbColumnSchema::$comment property) (resurtm)
- Enh: Fixed the check for ajaxUpdate false value in jquery.yiilistview.js as that never happens (mdomba)
- Enh: Requirements checker: added check for Oracle database (pdo_oci extension) and MSSQL (pdo_dblib, pdo_sqlsrv and pdo_mssql extensions) (resurtm)
- Chg: MSSQL unit tests updated and actualized, added SQLSRV driver support (resurtm)
- Chg: Updated CHttpCacheFilter to use dates as specified by RFC 1123 (bramp)

Version 1.1.12 August 19, 2012
------------------------------
- Bug #190: WSDL return tag was not generated by CWsdlGenerator when Macintosh line endings were used inside service describing docblock (resurtm)
- Bug #1066: CMemCache: expiration time higher than 60*60*24*30 (31536000) seconds led the value to expire right away after saving (resurtm)
- Bug #1072: Fixed the problem with getTableAlias() in defaultScope() (creocoder) - Bug #1072: Fixed the problem with getTableAlias() in defaultScope() (creocoder)
- Bug #1076: CJavaScript::encode() was not compatible with PHP 5.1 (samdark)
- Bug #1077: Fixed the problem with alias in CSort (creocoder)
- Bug #1083: CFileValidator is now unsafe by default. This will prevent setting attribute when no file was uploaded (samdark)
- Bug #1087: Reverted changes to CCookieCollection::add() introduced in 1.1.11 as they were triggering E_STRICT on some old PHP-versions (suralc)
- Bug #1088: Fixed usage of proper CActiveForm id property when it's supplied with htmlOptions (mdomba)
- Bug #1094: CGridView with enabled history used to clear page title in case sorting or paging performed (Opera and Firefox only) (resurtm)
- Bug #1109: Fixed "js:" encoding BC-break in CHtml::ajax() and related methods introduced in 1.1.11 (samdark)
- Bug #1120: Fixed duplicate events processing in CGridView when ENTER was pressed for filtering (mdomba)
- Bug #1192: CHttpCacheFilter failed to comply with RFC 2616, section 10.3.5 (DaSourcerer)
- Bug #1207: Fixed an issue in CHtml::resolveValue() which occurs when handling tabular data input (Qiang)
- Bug #1225: Fixed the bug that $.fn.yiiGridView.getChecked was not working always if a custom CGridView::template was used (mdomba)
- Bug #1243: Fixed the bug that when using CUrlManager::addRules with $append=false rules were added in reverse order (samdark)
- Enh #243: CWebService is now able to deal with the customized WSDL generator classes, was hardcoded to the CWsdlGenerator before, added CWebService::$generatorConfig property (resurtm)
- Enh #636: CManyManyRelation now parses foreign key for the junction table data internally, and provide public interface to access it (klimov-paul) - Enh #636: CManyManyRelation now parses foreign key for the junction table data internally, and provide public interface to access it (klimov-paul)

- Enh #1163: CGridview does not create empty class attributes anymore (cebe)
- Chg #1099: Changed connectionId dropdown to sticky text field in Gii model generator (mdomba)
- Chg #1167: Reverted back the change to CComponent::evaluateExpression() about global function support (Qiang)


Version 1.1.11 July 29, 2012 Version 1.1.11 July 29, 2012
---------------------------- ----------------------------
Expand Down
12 changes: 9 additions & 3 deletions UPGRADE
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@


Upgrading Instructions for Yii Framework v1.1.12 Upgrading Instructions for Yii Framework v1.1.13
================================================ ================================================


!!!IMPORTANT!!! !!!IMPORTANT!!!
Expand All @@ -9,8 +9,8 @@ if you want to upgrade from version A to version C and there is
version B between A and C, you need to following the instructions version B between A and C, you need to following the instructions
for both A and B. for both A and B.


General upgrade intructions General upgrade instructions
--------------------------- ----------------------------
- Make a backup. - Make a backup.
- Clean up your 'assets' folder. - Clean up your 'assets' folder.
- Replace 'framework' dir with the new one or point GIT to a fresh - Replace 'framework' dir with the new one or point GIT to a fresh
Expand Down Expand Up @@ -38,6 +38,12 @@ Upgrading from v1.1.12


Upgrading from v1.1.11 Upgrading from v1.1.11
---------------------- ----------------------
- Changes in CCookieCollection::add() (introduced in 1.1.11) were reverted as they were triggering E_STRICT on some old PHP-versions
If your application relies on these newly added changes. You should change your code from

$cookies->add(new CHttpCookie($name, $value));
to
$cookies[$name] = new CHttpCookie($name, $value);


Upgrading from v1.1.10 Upgrading from v1.1.10
---------------------- ----------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/comment.admin.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Comment management includes updating, deleting and approving comments. These ope
Updating and Deleting Comments Updating and Deleting Comments
------------------------------ ------------------------------


The code generated by `yiic` for updating and deleting comments remains largely unchanged. The code generated by `Gii` for updating and deleting comments remains largely unchanged.




Approving Comments Approving Comments
Expand Down
4 changes: 2 additions & 2 deletions docs/blog/comment.model.txt
Original file line number Original file line Diff line number Diff line change
@@ -1,13 +1,13 @@
Customizing Comment Model Customizing Comment Model
========================= =========================


For the `Comment` model, we mainly need to customize the `rules()` and `attributeLabels()` methods. The `attributeLabels()` method returns a mapping between attribute names and attribute labels. We do not need to touch `relations()` since the code generated by the `yiic` tool is good enough. For the `Comment` model, we mainly need to customize the `rules()` and `attributeLabels()` methods. The `attributeLabels()` method returns a mapping between attribute names and attribute labels. We do not need to touch `relations()` since the code generated by the `Gii` tool is good enough.




Customizing `rules()` Method Customizing `rules()` Method
---------------------------- ----------------------------


We first customize the validation rules generated by the `yiic` tool. The following rules are used for comments: We first customize the validation rules generated by the `Gii` tool. The following rules are used for comments:


~~~ ~~~
[php] [php]
Expand Down
46 changes: 37 additions & 9 deletions docs/blog/ja/comment.admin.txt
Original file line number Original file line Diff line number Diff line change
@@ -1,21 +1,21 @@
コメントの管理 コメントの管理
============== ==============


コメントの管理には、コメントの更新・削除・承認があります。これらの操作は`CommentController`クラスのアクションとして実装します。 コメントの管理には、コメントの更新・削除・承認があります。これらの操作は `CommentController` クラスのアクションとして実装します。




コメントの更新と削除 コメントの更新と削除
-------------------- --------------------


`yiic`で生成したコードの、コメント更新・削除の部分はほとんど変更せずに使います。 `Gii` で生成したコードの、コメント更新・削除の部分はほとんど変更せずに使います。




コメントの承認 コメントの承認
-------------- --------------


コメントが新しく作成されたとき、コメントは承認待ちの状態になります。ゲストユーザに見えるようにするためには承認が必要です。コメントの承認は、基本的にコメントのステータス・カラムを変更するだけです。 コメントが新しく作成されたとき、コメントは承認待ちの状態になります。ゲストユーザに見えるようにするためには承認が必要です。コメントの承認は、基本的にコメントの `status` カラムを変更するだけです。


`CommentController``actionApprove()`メソッドを以下のように作成します `CommentController` に以下のような `actionApprove()` メソッドを作成します


~~~ ~~~
[php] [php]
Expand All @@ -32,9 +32,37 @@ public function actionApprove()
} }
~~~ ~~~


上記コードでは、POSTリクエスト経由で`approve`アクションが呼ばれたときに、`Comment`モデルで定義した`approve()`メソッドを呼んでステータスを変更します。それから、このコメントが属する記事を表示するページに、ブラウザをリダイレクトします。 上記コードでは、POST リクエスト経由で `approve` アクションが呼ばれたときに、`Comment` モデルで定義した `approve()` メソッドを呼んでステータスを変更します。それから、このコメントが属する記事を表示するページに、ブラウザをリダイレクトします。


また、すべてのコメントを表示するために`Comment`の`actionIndex()`メソッドを修正します。承認待ちのコメントを先頭に表示するようにします。 もちろん、上記に加えて、`Comment` モデルに `approve()` メソッドを作成する必要もあります。以下のようにします。

~~~
[php]
public function approve()
{
$this->status=Comment::STATUS_APPROVED;
$this->update(array('status'));
}
~~~

していることは単純なことです。まず、コメントの `status` プロパティに `Comment` クラスで定義されている `承認済み` 状態を示す定数をセットします。

~~~
[php]
class Comment extends CActiveRecord
{
...

const STATUS_PENDING=1;
const STATUS_APPROVED=2;

..
}
~~~

そして、次に、`update()` メソッドを呼んで新しくセットされたプロパティをデータベースに保存します。

さらに、すべてのコメントを表示するために `CommentController` の `actionIndex()` メソッドを修正します。承認待ちのコメントを先頭に表示するようにします。


~~~ ~~~
[php] [php]
Expand All @@ -53,8 +81,8 @@ public function actionIndex()
} }
~~~ ~~~


上記コードでは、`tbl_post``tbl_comment`の両方に`status``create_time`というカラムがあるので、曖昧さを無くすためにテーブルのエイリアス名を接頭辞として付ける必要があります。[ガイド](http://www.yiiframework.com/doc/guide/ja/database.arr#disambiguating-column-names)に記述されているように、リレーショナルなクエリーでは、プライマリテーブルのエイリアスは常に`t`です。そのため上記コードでは、`status`カラムと`create_time`カラムに接頭辞`t`を付けています 上記コードでは、`tbl_post``tbl_comment` の両方に `status``create_time` というカラムがあるので、曖昧さを無くすためにテーブルのエイリアス名を接頭辞として付ける必要があります。[ガイド](http://www.yiiframework.com/doc/guide/ja/database.arr#sec-6) に記述されているように、リレーショナルなクエリーでは、プライマリテーブルのエイリアスは常に `t` です。そのため上記コードでは、`status` カラムと `create_time` カラムに接頭辞 `t` を付けて、それらの値をプライマリテーブル (`tbl_comment`) から取得すべきことを示しています


記事のindexビューのように、`CommentController``index`ビューでも[CListView]を使ってコメント一覧を表示します。部分的ビューとして`/wwwroot/blog/protected/views/comment/_view.php`を使って、個々のコメントの詳細を表示します。ここでは詳細には立ち入りません。興味のある方はblogデモの対応するファイル`/wwwroot/yii/demos/blog/protected/views/comment/_view.php`を参照してください。 記事の index ビューのように、`CommentController``index` ビューでも [CListView] を使ってコメント一覧を表示します。部分的ビューとして `/wwwroot/blog/protected/views/comment/_view.php` を使って、個々のコメントの詳細を表示します。ここでは詳細には立ち入りません。興味のある方はブログデモの対応するファイル `/wwwroot/yii/demos/blog/protected/views/comment/_view.php` を参照してください。


<div class="revision">$Id: comment.admin.txt 1810 2010-02-18 00:24:54Z qiang.xue $</div> <div class="revision">$Id$</div>
Loading

0 comments on commit be1fbf1

Please sign in to comment.