mirocow\eav\EavModel::save PHP Method

save() public method

public save ( $runValidation = true, $attributes = null )
    public function save($runValidation = true, $attributes = null)
    {
        if (!$this->handlers) {
            Yii::info(Yii::t('eav', 'Dynamic model data were no attributes.'), __METHOD__);
            return false;
        }
        if ($runValidation && !$this->validate($attributes)) {
            Yii::info(Yii::t('eav', 'Dynamic model data were not save due to validation error.'), __METHOD__);
            return false;
        }
        $db = $this->entityModel->getDb();
        $transaction = $db->beginTransaction();
        try {
            foreach ($this->handlers as $handler) {
                $handler->valueHandler->save();
            }
            $transaction->commit();
        } catch (\Exception $e) {
            $transaction->rollBack();
            throw $e;
        }
    }