Commit 622d0396225c54c607485cd89413b4de497ec394
1 parent
c616c474
Artbox great prepairings
Showing
11 changed files
with
25 additions
and
25 deletions
Show diff stats
composer.json
@@ -6,7 +6,8 @@ | @@ -6,7 +6,8 @@ | ||
6 | "type": "yii2-extension", | 6 | "type": "yii2-extension", |
7 | "require": { | 7 | "require": { |
8 | "php": ">=7.0", | 8 | "php": ">=7.0", |
9 | - "yiisoft/yii2": "~2.0" | 9 | + "yiisoft/yii2": "~2.0", |
10 | + "artweb/artbox-core": "~0.0.1" | ||
10 | }, | 11 | }, |
11 | "autoload": { | 12 | "autoload": { |
12 | "psr-4": { | 13 | "psr-4": { |
controllers/OrderController.php
@@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
2 | 2 | ||
3 | namespace artbox\order\controllers; | 3 | namespace artbox\order\controllers; |
4 | 4 | ||
5 | - use artbox\catalog\models\Product; | ||
6 | use artbox\catalog\models\Variant; | 5 | use artbox\catalog\models\Variant; |
7 | use artbox\order\models\Delivery; | 6 | use artbox\order\models\Delivery; |
8 | use artbox\order\models\Label; | 7 | use artbox\order\models\Label; |
@@ -12,7 +11,6 @@ | @@ -12,7 +11,6 @@ | ||
12 | use artbox\order\models\Order; | 11 | use artbox\order\models\Order; |
13 | use artbox\order\models\OrderSearch; | 12 | use artbox\order\models\OrderSearch; |
14 | use yii\base\InvalidParamException; | 13 | use yii\base\InvalidParamException; |
15 | - use yii\base\Model; | ||
16 | use yii\web\Controller; | 14 | use yii\web\Controller; |
17 | use yii\web\NotFoundHttpException; | 15 | use yii\web\NotFoundHttpException; |
18 | use yii\filters\VerbFilter; | 16 | use yii\filters\VerbFilter; |
models/Customer.php
@@ -13,9 +13,8 @@ | @@ -13,9 +13,8 @@ | ||
13 | 13 | ||
14 | /** | 14 | /** |
15 | * This is the model class for table "customer". | 15 | * This is the model class for table "customer". |
16 | - | ||
17 | -* | ||
18 | -*@property integer $id | 16 | + * |
17 | + * @property integer $id | ||
19 | * @property string $username | 18 | * @property string $username |
20 | * @property string $auth_key | 19 | * @property string $auth_key |
21 | * @property string $password_hash | 20 | * @property string $password_hash |
models/DeliverySearch.php
@@ -2,10 +2,8 @@ | @@ -2,10 +2,8 @@ | ||
2 | 2 | ||
3 | namespace artbox\order\models; | 3 | namespace artbox\order\models; |
4 | 4 | ||
5 | - use Yii; | ||
6 | use yii\base\Model; | 5 | use yii\base\Model; |
7 | use yii\data\ActiveDataProvider; | 6 | use yii\data\ActiveDataProvider; |
8 | - use artbox\order\models\Delivery; | ||
9 | 7 | ||
10 | /** | 8 | /** |
11 | * DeliverySearch represents the model behind the search form about `artbox\order\models\Delivery`. | 9 | * DeliverySearch represents the model behind the search form about `artbox\order\models\Delivery`. |
models/LabelSearch.php
@@ -2,10 +2,8 @@ | @@ -2,10 +2,8 @@ | ||
2 | 2 | ||
3 | namespace artbox\order\models; | 3 | namespace artbox\order\models; |
4 | 4 | ||
5 | - use Yii; | ||
6 | use yii\base\Model; | 5 | use yii\base\Model; |
7 | use yii\data\ActiveDataProvider; | 6 | use yii\data\ActiveDataProvider; |
8 | - use artbox\order\models\Label; | ||
9 | 7 | ||
10 | /** | 8 | /** |
11 | * LabelSearch represents the model behind the search form about `artbox\order\models\Label`. | 9 | * LabelSearch represents the model behind the search form about `artbox\order\models\Label`. |
models/OrderProductSearch.php
@@ -2,10 +2,8 @@ | @@ -2,10 +2,8 @@ | ||
2 | 2 | ||
3 | namespace artbox\order\models; | 3 | namespace artbox\order\models; |
4 | 4 | ||
5 | - use Yii; | ||
6 | use yii\base\Model; | 5 | use yii\base\Model; |
7 | use yii\data\ActiveDataProvider; | 6 | use yii\data\ActiveDataProvider; |
8 | - use artbox\order\models\OrderProduct; | ||
9 | 7 | ||
10 | /** | 8 | /** |
11 | * OrderProductSearch represents the model behind the search form about `artbox\order\models\OrderProduct`. | 9 | * OrderProductSearch represents the model behind the search form about `artbox\order\models\OrderProduct`. |
models/OrderSearch.php
@@ -2,10 +2,8 @@ | @@ -2,10 +2,8 @@ | ||
2 | 2 | ||
3 | namespace artbox\order\models; | 3 | namespace artbox\order\models; |
4 | 4 | ||
5 | - use Yii; | ||
6 | use yii\base\Model; | 5 | use yii\base\Model; |
7 | use yii\data\ActiveDataProvider; | 6 | use yii\data\ActiveDataProvider; |
8 | - use artbox\order\models\Order; | ||
9 | 7 | ||
10 | /** | 8 | /** |
11 | * OrderSearch represents the model behind the search form about `artbox\order\models\Order`. | 9 | * OrderSearch represents the model behind the search form about `artbox\order\models\Order`. |
models/PasswordForm.php
@@ -10,7 +10,10 @@ | @@ -10,7 +10,10 @@ | ||
10 | public $oldpass; | 10 | public $oldpass; |
11 | public $newpass; | 11 | public $newpass; |
12 | public $repeatnewpass; | 12 | public $repeatnewpass; |
13 | - | 13 | + |
14 | + /** | ||
15 | + * @inheritdoc | ||
16 | + */ | ||
14 | public function rules() | 17 | public function rules() |
15 | { | 18 | { |
16 | return [ | 19 | return [ |
@@ -36,22 +39,29 @@ | @@ -36,22 +39,29 @@ | ||
36 | 39 | ||
37 | public function validatePassword($attribute) | 40 | public function validatePassword($attribute) |
38 | { | 41 | { |
42 | + /** | ||
43 | + * @var \artbox\core\models\User $identity | ||
44 | + */ | ||
45 | + $identity = \Yii::$app->user->identity; | ||
39 | if (!Yii::$app->getSecurity() | 46 | if (!Yii::$app->getSecurity() |
40 | ->validatePassword( | 47 | ->validatePassword( |
41 | $this->oldpass, | 48 | $this->oldpass, |
42 | - \Yii::$app->user->identity->password_hash | 49 | + $identity->password_hash |
43 | ) | 50 | ) |
44 | ) { | 51 | ) { |
45 | $this->addError($attribute, 'Old password is incorrect'); | 52 | $this->addError($attribute, 'Old password is incorrect'); |
46 | } | 53 | } |
47 | } | 54 | } |
48 | - | 55 | + |
56 | + /** | ||
57 | + * @inheritdoc | ||
58 | + */ | ||
49 | public function attributeLabels() | 59 | public function attributeLabels() |
50 | { | 60 | { |
51 | return [ | 61 | return [ |
52 | - 'oldpass' => \Yii::t('app', 'Старый пароль'), | ||
53 | - 'newpass' => \Yii::t('app', 'Новый пароль'), | ||
54 | - 'repeatnewpass' => \Yii::t('app', 'Повторите новый пароль'), | 62 | + 'oldpass' => \Yii::t('order', 'Старый пароль'), |
63 | + 'newpass' => \Yii::t('order', 'Новый пароль'), | ||
64 | + 'repeatnewpass' => \Yii::t('order', 'Повторите новый пароль'), | ||
55 | ]; | 65 | ]; |
56 | } | 66 | } |
57 | } | 67 | } |
58 | \ No newline at end of file | 68 | \ No newline at end of file |
models/Payment.php
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | use artbox\core\models\Language; | 6 | use artbox\core\models\Language; |
7 | use Yii; | 7 | use Yii; |
8 | use yii\db\ActiveQuery; | 8 | use yii\db\ActiveQuery; |
9 | + use yii\db\ActiveRecord; | ||
9 | use yii\web\Request; | 10 | use yii\web\Request; |
10 | 11 | ||
11 | /** | 12 | /** |
@@ -41,7 +42,7 @@ | @@ -41,7 +42,7 @@ | ||
41 | * * End language behavior * | 42 | * * End language behavior * |
42 | * @see LanguageBehavior | 43 | * @see LanguageBehavior |
43 | */ | 44 | */ |
44 | - class Payment extends \yii\db\ActiveRecord | 45 | + class Payment extends ActiveRecord |
45 | { | 46 | { |
46 | /** | 47 | /** |
47 | * @inheritdoc | 48 | * @inheritdoc |
models/PaymentLang.php
@@ -4,7 +4,8 @@ | @@ -4,7 +4,8 @@ | ||
4 | 4 | ||
5 | use artbox\core\models\Language; | 5 | use artbox\core\models\Language; |
6 | use Yii; | 6 | use Yii; |
7 | - | 7 | + use yii\db\ActiveRecord; |
8 | + | ||
8 | /** | 9 | /** |
9 | * This is the model class for table "payment_lang". | 10 | * This is the model class for table "payment_lang". |
10 | * | 11 | * |
@@ -15,7 +16,7 @@ | @@ -15,7 +16,7 @@ | ||
15 | * @property Language $language | 16 | * @property Language $language |
16 | * @property Payment $payment | 17 | * @property Payment $payment |
17 | */ | 18 | */ |
18 | - class PaymentLang extends \yii\db\ActiveRecord | 19 | + class PaymentLang extends ActiveRecord |
19 | { | 20 | { |
20 | /** | 21 | /** |
21 | * @inheritdoc | 22 | * @inheritdoc |
models/PaymentSearch.php
@@ -2,10 +2,8 @@ | @@ -2,10 +2,8 @@ | ||
2 | 2 | ||
3 | namespace artbox\order\models; | 3 | namespace artbox\order\models; |
4 | 4 | ||
5 | - use Yii; | ||
6 | use yii\base\Model; | 5 | use yii\base\Model; |
7 | use yii\data\ActiveDataProvider; | 6 | use yii\data\ActiveDataProvider; |
8 | - use artbox\order\models\Payment; | ||
9 | 7 | ||
10 | /** | 8 | /** |
11 | * PaymentSearch represents the model behind the search form about `artbox\order\models\Payment`. | 9 | * PaymentSearch represents the model behind the search form about `artbox\order\models\Payment`. |