src/importers/PropertyImporter.php
protected function install($object)
    {
        $model = Property::find()->where(['var_name' => $object->varName()])->one();
        if ($model) {
            $model->setAttributes([
                'module_name' => $object->moduleName,
                'class_name' => $object::className(),
            ]);
            $model->update(false);
    
            return $model->id;
        } else {
            $model = new Property();
            $model->setAttributes([
                'var_name' => $object->varName(),
                'module_name' => $object->moduleName,
                'class_name' => $object::className(),
            ]);
            $insert = $model->insert(false);
            if ($insert) {
                return $model->id;
            }
        }
    }
protected function install($object)
    {
        $model = Property::find()->where(['var_name' => $object->varName()])->one();
        if ($model) {
            $model->setAttributes([
                'module_name' => $object->moduleName,
                'class_name' => $object::className(),
            ]);
            $model->update(false);
    
            return $model->id;
        } else {
            $model = new Property();
            $model->setAttributes([
                'var_name' => $object->varName(),
                'module_name' => $object->moduleName,
                'class_name' => $object::className(),
            ]);
            $insert = $model->insert(false);
            if ($insert) {
                return $model->id;
            }
        }
    }
protected function install ( $ object ) { $ model = Property :: find ( ) -> where ( [ 'var_name' => $ object -> varName ( ) ] ) -> one ( ) ; if ( $ model ) { $ model -> setAttributes ( [ 'module_name' => $ object -> moduleName , 'class_name' => $ object :: className ( ) , ] ) ; $ model -> update ( false ) ; return $ model -> id ; } else { $ model = new Property ( ) ; $ model -> setAttributes ( [ 'var_name' => $ object -> varName ( ) , 'module_name' => $ object -> moduleName , 'class_name' => $ object :: className ( ) , ] ) ; $ insert = $ model -> insert ( false ) ; if ( $ insert ) { return $ model -> id ; } } }
Installation of the property
Installation of the property