示例#1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getLogisticStrategy()
 {
     return $this->hasOne(LogisticStrategy::className(), ['id' => 'logistic_strategy_id']);
 }
示例#2
0
 /**
  * Update logistic strategy action
  * @throws \yii\db\Exception
  */
 public function actionUpdateLogisticStrategy()
 {
     $request = Yii::$app->request;
     $transaction = LogisticStrategy::getDb()->beginTransaction();
     $logistic = LogisticStrategy::findOne($request->get('id'));
     $logistic->scenario = 'update';
     $logistic->clearData();
     $logistic->strategy = $request->get('strategy');
     $logistic->logisticData = $request->post('strategy');
     if (!$logistic->save()) {
         $transaction->rollBack();
         var_dump($logistic->errors);
         var_dump($logistic);
     } else {
         $transaction->commit();
         TagDependency::invalidate(Yii::$app->commonCache, Product::generateTagStatic($request->get('product'), 'productLogisticStrategy'));
     }
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getLogisticStrategies()
 {
     return $this->hasMany(LogisticStrategy::className(), ['supplier_id' => 'id']);
 }