From 3f6fec3c55d16ac2bbca592f23edc1021f18c2ac Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 11 Jan 2014 17:25:54 -0500 Subject: [PATCH 1/4] refactored Json helper. --- framework/helpers/BaseJson.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/framework/helpers/BaseJson.php b/framework/helpers/BaseJson.php index ce65f8d7ca..bf62e8b37f 100644 --- a/framework/helpers/BaseJson.php +++ b/framework/helpers/BaseJson.php @@ -81,18 +81,20 @@ class BaseJson */ protected static function processData($data, &$expressions, $expPrefix) { - if ($data instanceof \JsonSerializable) { - $data = $data->jsonSerialize(); - } - if (is_object($data)) { if ($data instanceof JsExpression) { $token = "!{[$expPrefix=" . count($expressions) . ']}!'; $expressions['"' . $token . '"'] = $data->expression; return $token; + } elseif ($data instanceof \JsonSerializable) { + $data = $data->jsonSerialize(); + } elseif ($data instanceof Arrayable) { + $data = $data->toArray(); + } else { + $data = get_object_vars($data); } - $data = $data instanceof Arrayable ? $data->toArray() : get_object_vars($data); - if ($data === [] && !$data instanceof Arrayable) { + + if ($data === []) { return new \stdClass(); } } From d6eeab2ff35934288ba72ea112010fb8c0d6a31d Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 11 Jan 2014 17:27:23 -0500 Subject: [PATCH 2/4] updated class map --- framework/classes.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/classes.php b/framework/classes.php index 9606930c2c..296dda2034 100644 --- a/framework/classes.php +++ b/framework/classes.php @@ -30,6 +30,7 @@ return [ 'yii\base\InvalidConfigException' => YII_PATH . '/base/InvalidConfigException.php', 'yii\base\InvalidParamException' => YII_PATH . '/base/InvalidParamException.php', 'yii\base\InvalidRouteException' => YII_PATH . '/base/InvalidRouteException.php', + 'yii\base\MailEvent' => YII_PATH . '/base/MailEvent.php', 'yii\base\Model' => YII_PATH . '/base/Model.php', 'yii\base\ModelEvent' => YII_PATH . '/base/ModelEvent.php', 'yii\base\Module' => YII_PATH . '/base/Module.php', @@ -108,6 +109,8 @@ return [ 'yii\db\mssql\TableSchema' => YII_PATH . '/db/mssql/TableSchema.php', 'yii\db\mysql\QueryBuilder' => YII_PATH . '/db/mysql/QueryBuilder.php', 'yii\db\mysql\Schema' => YII_PATH . '/db/mysql/Schema.php', + 'yii\db\oci\QueryBuilder' => YII_PATH . '/db/oci/QueryBuilder.php', + 'yii\db\oci\Schema' => YII_PATH . '/db/oci/Schema.php', 'yii\db\pgsql\QueryBuilder' => YII_PATH . '/db/pgsql/QueryBuilder.php', 'yii\db\pgsql\Schema' => YII_PATH . '/db/pgsql/Schema.php', 'yii\db\sqlite\QueryBuilder' => YII_PATH . '/db/sqlite/QueryBuilder.php', @@ -220,7 +223,6 @@ return [ 'yii\web\PageCache' => YII_PATH . '/web/PageCache.php', 'yii\web\Request' => YII_PATH . '/web/Request.php', 'yii\web\Response' => YII_PATH . '/web/Response.php', - 'yii\web\ResponseEvent' => YII_PATH . '/web/ResponseEvent.php', 'yii\web\ResponseFormatterInterface' => YII_PATH . '/web/ResponseFormatterInterface.php', 'yii\web\Session' => YII_PATH . '/web/Session.php', 'yii\web\SessionIterator' => YII_PATH . '/web/SessionIterator.php', From 3ed1125172f958b3b4008d4a5b351cb1515e62c3 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sat, 11 Jan 2014 23:26:19 +0100 Subject: [PATCH 3/4] added CHANGELOG line for PSR4 directory move --- framework/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index fd54fcd02f..07e2103989 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -81,6 +81,8 @@ Yii Framework 2 Change Log - Chg: Changed the signature of `urlCreator` and button creators for `yii\gridview\ActionColumn` (qiangxue) - Chg: Updated HTMLPurified dependency to `4.6.*`. - Chg: Changed Yii autoloader to support loading PSR-4 classes only (i.e. PEAR-styled classes not supported anymore) (qiangxue) +- Chg: Changed the directory structure of the framework repository according to PSR-4. + You have to update your applications index.php and yii console file to point to the right location for Yii.php - Chg: Advanced app template: moved database connection DSN, login and password to `-local` config not to expose it to VCS (samdark) - New #66: [Auth client library](https://github.com/yiisoft/yii2-authclient) OpenId, OAuth1, OAuth2 clients (klimov-paul) - New #1393: [Codeception testing framework integration](https://github.com/yiisoft/yii2-codeception) (Ragazzo) From 135f06413a21243f6a48d568c8867f453e1266da Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 11 Jan 2014 17:33:48 -0500 Subject: [PATCH 4/4] fixed phpdoc command. fixed Markdown::process() to make it compatible with parent declaration. --- build/controllers/PhpDocController.php | 2 +- extensions/apidoc/helpers/Markdown.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php index ecde1e5618..e711fb6604 100644 --- a/build/controllers/PhpDocController.php +++ b/build/controllers/PhpDocController.php @@ -43,7 +43,7 @@ class PhpDocController extends Controller { $except = []; if ($root === null) { - $root = dirname(dirname(YII_PATH)); + $root = dirname(YII_PATH); $extensionPath = "$root/extensions"; foreach (scandir($extensionPath) as $extension) { if (ctype_alpha($extension) && is_dir($extensionPath . '/' . $extension)) { diff --git a/extensions/apidoc/helpers/Markdown.php b/extensions/apidoc/helpers/Markdown.php index 6139b15e62..7c1800a8b5 100644 --- a/extensions/apidoc/helpers/Markdown.php +++ b/extensions/apidoc/helpers/Markdown.php @@ -32,7 +32,7 @@ class Markdown extends \yii\helpers\Markdown * @param TypeDoc $context * @return string */ - public static function process($content, $context) + public static function process($content, $context = null) { $content = trim(parent::process($content, [])); if (!strncmp($content, '

', 3) && substr($content, -4, 4) == '

') { @@ -77,4 +77,4 @@ class Markdown extends \yii\helpers\Markdown return $content; } -} \ No newline at end of file +}