From 7562fe940ee1a219527d2eb68158df30a5feed14 Mon Sep 17 00:00:00 2001 From: janfrs Date: Sat, 19 Sep 2015 17:05:28 -0300 Subject: [PATCH 1/3] Add Unprocessable Entity Exception as in #2106 --- framework/CHANGELOG.md | 1 + .../web/UnprocessableEntityHttpException.php | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 framework/web/UnprocessableEntityHttpException.php diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 9262614c35..6961f87c3c 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 Change Log 2.0.7 under development ----------------------- +- Enh #2106: Added Unprocessable Entity Http Exception (janfrs) - Bug #8723: Fixed `yii\helpers\VarDumper::export()` unable to export circle referenced objects with `Closure` (klimov-paul) - Bug #9108: Negative number resulted in no formatting when using `Formatter::asSize()` or `Formatter::asShortSize` (nxnx, cebe) - Bug #9288: Fixed `FileHelper::createDirectory` directory creation to be concurrency friendly (dynasource) diff --git a/framework/web/UnprocessableEntityHttpException.php b/framework/web/UnprocessableEntityHttpException.php new file mode 100644 index 0000000000..e7acaa9024 --- /dev/null +++ b/framework/web/UnprocessableEntityHttpException.php @@ -0,0 +1,35 @@ + + * @since 2.0 + */ +class UnprocessedEntityHttpException extends HttpException +{ + /** + * Constructor. + * @param string $message error message + * @param integer $code error code + * @param \Exception $previous The previous exception used for the exception chaining. + */ + public function __construct($message = null, $code = 0, \Exception $previous = null) + { + parent::__construct(422, $message, $code, $previous); + } +} From 07199cbf615c2a7ded4004943ea3779fa551a185 Mon Sep 17 00:00:00 2001 From: janfrs Date: Sun, 20 Sep 2015 15:18:52 -0300 Subject: [PATCH 2/3] Change to since 2.0.7 on UnprocessableEntity #2106 Thanks to @Renkas for noticing --- framework/web/UnprocessableEntityHttpException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/web/UnprocessableEntityHttpException.php b/framework/web/UnprocessableEntityHttpException.php index e7acaa9024..40967ba570 100644 --- a/framework/web/UnprocessableEntityHttpException.php +++ b/framework/web/UnprocessableEntityHttpException.php @@ -18,7 +18,7 @@ namespace yii\web; * * @link http://www.webdav.org/specs/rfc2518.html#STATUS_422 * @author Jan Silva - * @since 2.0 + * @since 2.0.7 */ class UnprocessedEntityHttpException extends HttpException { From 194b80b00e59495b105cbaa69e2ba68779bdeea9 Mon Sep 17 00:00:00 2001 From: janfrs Date: Sun, 20 Sep 2015 22:28:25 -0300 Subject: [PATCH 3/3] Fix comment msg UnprocessableEntity #2106 --- framework/CHANGELOG.md | 2 +- framework/web/UnprocessableEntityHttpException.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 6961f87c3c..c52d485e3a 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,7 +4,6 @@ Yii Framework 2 Change Log 2.0.7 under development ----------------------- -- Enh #2106: Added Unprocessable Entity Http Exception (janfrs) - Bug #8723: Fixed `yii\helpers\VarDumper::export()` unable to export circle referenced objects with `Closure` (klimov-paul) - Bug #9108: Negative number resulted in no formatting when using `Formatter::asSize()` or `Formatter::asShortSize` (nxnx, cebe) - Bug #9288: Fixed `FileHelper::createDirectory` directory creation to be concurrency friendly (dynasource) @@ -17,6 +16,7 @@ Yii Framework 2 Change Log - Bug #9678: `I18N::format()` wasn't able to handle named placeholder in "selectordinal" (samdark) - Chg #9369: `Yii::$app->user->can()` now returns `false` instead of erroring in case `authManager` component is not configured (creocoder) - Chg #9411: `DetailView` now automatically sets container tag ID in case it's not specified (samdark) +- Enh #2106: Added Unprocessable Entity Http Exception (janfrs) - Enh #9635: Added default CSS class for `\yii\grid\ActionColumn` header (arogachev, dynasource) diff --git a/framework/web/UnprocessableEntityHttpException.php b/framework/web/UnprocessableEntityHttpException.php index 40967ba570..93403ad100 100644 --- a/framework/web/UnprocessableEntityHttpException.php +++ b/framework/web/UnprocessableEntityHttpException.php @@ -12,8 +12,8 @@ namespace yii\web; * exception with status code 422. * * Use this exception to inform that the server understands the content type of - * the request entity and the syntax of that request entity is correct but was - * unable to process the contained instructions. For example, to return form + * the request entity and the syntax of that request entity is correct but server + * was unable to process the contained instructions. For example, to return form * validation errors. * * @link http://www.webdav.org/specs/rfc2518.html#STATUS_422