From 4fb5e6c31e0217437d84333c14c03cd2c16a9134 Mon Sep 17 00:00:00 2001 From: yarik Date: Wed, 12 Oct 2016 16:13:05 +0300 Subject: [PATCH] Import browser beta v0.1 --- common/modules/product/models/Import.php | 4 +++- common/modules/product/models/Product.php | 21 +++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/common/modules/product/models/Import.php b/common/modules/product/models/Import.php index ec1c223..3770d7c 100755 --- a/common/modules/product/models/Import.php +++ b/common/modules/product/models/Import.php @@ -533,7 +533,6 @@ /** * @var Product $_product */ - if(!empty( $parsed_name[ 'remote_id' ] ) && ( $_product = Product::find() ->joinWith('lang') ->andFilterWhere([ 'remote_id' => $parsed_name[ 'remote_id' ] ]) @@ -575,6 +574,9 @@ } else { $product_name_inserted = $_product->model_langs[ Language::$current->language_id ]->name; } + + $_product->validate(); + die(var_dump($_product->getErrors())); var_dump($_product->save()); die(); if(!$_product->transactionStatus) { diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php index daa0d20..b35e986 100755 --- a/common/modules/product/models/Product.php +++ b/common/modules/product/models/Product.php @@ -157,6 +157,15 @@ return $this->hasOne(Brand::className(), [ 'brand_id' => 'brand_id' ]); } + + + public function beforeValidate() + { + if(parent::beforeValidate()){ + die('here'); + } + } + /** * @return \yii\db\ActiveQuery */ @@ -345,18 +354,6 @@ ->sum('quantity'); } - public function beforeSave($insert) - { - - if (parent::beforeSave($insert)) { - var_dump('THERE'); die(); - return true; - } else { - var_dump('THERE parent false'); die(); - return false; - } - } - public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); -- libgit2 0.21.4