From 4633c0cfac6bfa4c48dd01e1a98822a3638adec8 Mon Sep 17 00:00:00 2001 From: simialbi Date: Thu, 25 Apr 2019 12:58:14 +0200 Subject: [PATCH] Updated readme fixed tests --- README.md | 4 +++- src/Query.php | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 12be7cb..a944f98 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ To use this extension, configure restclient component in your application config // }, // 'auth' => 'Bearer: ', // 'usePluralisation' => false, + // 'enableExceptions' => true, ], ], ``` @@ -50,7 +51,8 @@ To use this extension, configure restclient component in your application config | ------------------ | ---------------------------------------------------------------------------------------------------------------- | | `baseUrl` | The location of the api. E.g. for http://api.site.com/v1/users the `baseUrl` would be http://api.site.com/v1/ | | `auth` | Either a Closure which returns a `string` or a `string`. The rest connection will be passed as parameter. | -| `usePluralisation` | Whether to use plural version for lists (index action) or not (e.g. http://api.site.com/users instead of `user`) | +| `usePluralisation` | Whether to use plural version for lists (index action) or not (e.g. http://api.site.com/users instead of `user`) | +| `enableExceptions` | Whether the connection should throw an exception if response is not 200 or not | ## Usage Define your Model diff --git a/src/Query.php b/src/Query.php index 1c5c80c..bb46271 100644 --- a/src/Query.php +++ b/src/Query.php @@ -13,6 +13,8 @@ /** * Class Query + * + * @property string $modelClass the name of the ActiveRecord class. */ class Query extends \yii\db\Query implements QueryInterface { @@ -24,7 +26,7 @@ class Query extends \yii\db\Query implements QueryInterface /** * @var mixed Value of the primary key (special where) */ - public $modelClass; + private $_modelClass; /** * Constructor. @@ -154,4 +156,22 @@ public static function create($from) 'params' => $from->params, ]); } + + /** + * Getter for modelClass + * @return mixed + */ + public function getModelClass() + { + return $this->_modelClass; + } + + /** + * Setter for modelClass + * @param mixed $modelClass + */ + public function setModelClass($modelClass) + { + $this->_modelClass = $modelClass; + } }