当前位置: 首页>>代码示例>>PHP>>正文


PHP Property::className方法代码示例

本文整理汇总了PHP中app\models\Property::className方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::className方法的具体用法?PHP Property::className怎么用?PHP Property::className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Property的用法示例。


在下文中一共展示了Property::className方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepareProperties

 private function prepareProperties()
 {
     $props = Property::getDb()->cache(function ($db) {
         return Property::find()->select('id, name, property_handler_id, key, property_group_id, has_static_values, is_eav, handler_additional_params')->all();
     }, 86400, new TagDependency(['tags' => [ActiveRecordHelper::getCommonTag(Property::className())]]));
     foreach ($props as $one) {
         $additionalParams = Json::decode($one['handler_additional_params']);
         if (false === empty($additionalParams['use_in_file'])) {
             if (1 == $one['is_eav'] && false === isset(self::$ymlEavProperties[$one['id']])) {
                 self::$ymlEavProperties[$one['id']] = ['name' => $one['name'], 'unit' => empty($additionalParams['unit']) ? '' : $additionalParams['unit'], 'key' => $one['key'], 'group_id' => $one['property_group_id'], 'handler_id' => $one['property_handler_id']];
             } else {
                 if (1 == $one['has_static_values'] && false === isset(self::$ymlStaticProperties[$one['id']])) {
                     self::$ymlStaticProperties[$one['id']] = ['name' => $one['name'], 'unit' => empty($additionalParams['unit']) ? '' : $additionalParams['unit']];
                 }
             }
         }
     }
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:18,代码来源:YmlController.php

示例2: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->object = Object::getForClass(get_class($this->model));
     $cacheKey = 'PropertiesWidget: ' . get_class($this->model) . ':' . $this->model->id;
     $data = Yii::$app->cache->get($cacheKey);
     if ($data === false) {
         $this->objectPropertyGroups = ObjectPropertyGroup::getForModel($this->model);
         $addedPropertyGroupsIds = [];
         foreach ($this->objectPropertyGroups as $opg) {
             $addedPropertyGroupsIds[] = $opg->property_group_id;
         }
         $restPg = (new Query())->select('id, name')->from(PropertyGroup::tableName())->where(['object_id' => $this->object->id])->andWhere(['not in', 'id', $addedPropertyGroupsIds])->orderBy('sort_order')->all();
         $this->propertyGroupsToAdd = ArrayHelper::map($restPg, 'id', 'name');
         Yii::$app->cache->set($cacheKey, ['objectPropertyGroups' => $this->objectPropertyGroups, 'propertyGroupsToAdd' => $this->propertyGroupsToAdd], 86400, new TagDependency(['tags' => [ActiveRecordHelper::getCommonTag(get_class($this->model)), ActiveRecordHelper::getCommonTag(PropertyGroup::className()), ActiveRecordHelper::getCommonTag(Property::className())]]));
     } else {
         $this->objectPropertyGroups = $data['objectPropertyGroups'];
         $this->propertyGroupsToAdd = $data['propertyGroupsToAdd'];
     }
     return $this->render($this->viewFile, ['model' => $this->model, 'object' => $this->object, 'object_property_groups' => $this->objectPropertyGroups, 'property_groups_to_add' => $this->propertyGroupsToAdd, 'form' => $this->form, 'widget_id' => $this->getId()]);
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:23,代码来源:PropertiesWidget.php

示例3: actionEditProperty

 public function actionEditProperty($property_group_id, $id = null)
 {
     if ($id === null) {
         $model = new Property();
         $model->handler_additional_params = '[]';
     } else {
         $model = Property::findById($id);
     }
     $object = Object::getForClass(Property::className());
     $model->property_group_id = $property_group_id;
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         $propertyHandler = PropertyHandlers::createHandler($model->handler);
         if (!$propertyHandler->changePropertyType($model)) {
             if ($model->is_column_type_stored) {
                 if ($model->isNewRecord) {
                     $object = Object::findById($model->group->object_id);
                     Yii::$app->db->createCommand()->addColumn($object->column_properties_table_name, $model->key, "TINYTEXT")->execute();
                     if ($object->object_class == Form::className()) {
                         $submissionObject = Object::getForClass(Submission::className());
                         $col_type = $this->getColumnType($model->value_type);
                         Yii::$app->db->createCommand()->addColumn($submissionObject->column_properties_table_name, $model->key, $col_type)->execute();
                     }
                 } else {
                     if ($model->key != $model->getOldAttribute('key')) {
                         $object = Object::findById($model->group->object_id);
                         Yii::$app->db->createCommand()->renameColumn($object->column_properties_table_name, $model->getOldAttribute('key'), $model->key)->execute();
                         if ($object->object_class == Form::className()) {
                             $submissionObject = Object::getForClass(Submission::className());
                             Yii::$app->db->createCommand()->renameColumn($submissionObject->column_properties_table_name, $model->getOldAttribute('key'), $model->key)->execute();
                         }
                     }
                     if ($model->value_type != $model->getOldAttribute('value_type')) {
                         $object = Object::findById($model->group->object_id);
                         $new_type = $this->getColumnType($model->value_type);
                         Yii::$app->db->createCommand()->alterColumn($object->column_properties_table_name, $model->getOldAttribute('key'), $new_type)->execute();
                         if ($object->object_class == Form::className()) {
                             $submissionObject = Object::getForClass(Submission::className());
                             Yii::$app->db->createCommand()->renameColumn($submissionObject->column_properties_table_name, $model->getOldAttribute('key'), $new_type)->execute();
                         }
                     }
                 }
             }
         }
         $save_result = $model->save();
         if ($save_result) {
             $this->runAction('save-info');
             Yii::$app->session->setFlash('success', Yii::t('app', 'Record has been saved'));
             $returnUrl = Yii::$app->request->get('returnUrl', ['/backend/properties/group', 'id' => $property_group_id]);
             switch (Yii::$app->request->post('action', 'save')) {
                 case 'next':
                     return $this->redirect(['/backend/properties/edit-property', 'property_group_id' => $property_group_id, 'returnUrl' => $returnUrl]);
                 case 'back':
                     return $this->redirect($returnUrl);
                 default:
                     return $this->redirect(Url::toRoute(['/backend/properties/edit-property', 'id' => $model->id, 'property_group_id' => $model->property_group_id, 'returnUrl' => $returnUrl]));
             }
         } else {
             Yii::$app->session->setFlash('error', Yii::t('app', 'Cannot save data'));
         }
     }
     $searchModel = new PropertyStaticValues();
     $searchModel->property_id = $model->id;
     $dataProvider = $searchModel->search($_GET);
     return $this->render('edit-property', ['model' => $model, 'dataProvider' => $dataProvider, 'searchModel' => $searchModel, 'fieldinterpretParentId' => 0, 'object' => $object]);
 }
开发者ID:ar7n,项目名称:dotplant2,代码行数:65,代码来源:PropertiesController.php

示例4: invalidateModelCache

 /**
  *
  */
 public function invalidateModelCache()
 {
     TagDependency::invalidate(Yii::$app->cache, [ActiveRecordHelper::getObjectTag(PropertyGroup::className(), $this->property_group_id), ActiveRecordHelper::getObjectTag(Property::className(), $this->id)]);
 }
开发者ID:kronos777,项目名称:dotplant2,代码行数:7,代码来源:Property.php

示例5: getProperties

 /**
  * Relation to properties
  * @return \yii\db\ActiveQuery
  */
 public function getProperties()
 {
     return $this->hasMany(Property::className(), ['property_group_id' => 'id'])->orderBy('sort_order');
 }
开发者ID:cooltheo,项目名称:dotplant2,代码行数:8,代码来源:PropertyGroup.php

示例6: getProperty

 /**
  * @return Property|null
  */
 public function getProperty()
 {
     return $this->hasOne(Property::className(), ['id' => 'model_id']);
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:7,代码来源:CommercemlGuid.php

示例7: arrayOfValuesForPropertyId

 /**
  * Аналогично getValuesForPropertyId
  * Но identity_map не используется
  * @param int $property_id
  * @return array|mixed|\yii\db\ActiveRecord[]
  */
 public static function arrayOfValuesForPropertyId($property_id)
 {
     $cacheKey = "ValuesForProperty:{$property_id}";
     if (false === ($values = Yii::$app->cache->get($cacheKey))) {
         $values = static::find()->where(['property_id' => $property_id])->orderBy(['sort_order' => SORT_ASC, 'name' => SORT_ASC])->asArray()->all();
         if (null !== $values) {
             Yii::$app->cache->set($cacheKey, $values, 0, new TagDependency(['tags' => [ActiveRecordHelper::getCommonTag(PropertyStaticValues::className()), ActiveRecordHelper::getCommonTag(Property::className())]]));
         }
     }
     return $values;
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:17,代码来源:PropertyStaticValues.php

示例8: renderProducts

 /**
  * renders product item and list.
  * possible can render all objects, but need for few logic change
  * @param array $chunkData params for select and render
  * @param TagDependency $dependency
  * @return mixed
  */
 private static function renderProducts($chunkData, &$dependency)
 {
     $params = ['itemView' => Yii::$app->getModule('shop')->itemView, 'type' => 'show', 'object' => 'product', 'where' => [], 'limit' => 0, 'listView' => Yii::$app->getModule('shop')->listView];
     switch ($chunkData['key']) {
         case 'product':
             if (ArrayHelper::keyExists('sku', $chunkData)) {
                 $params['where'] = ['sku' => $chunkData['sku']];
             }
             break;
         case 'productList':
             $params['type'] = 'list';
             break;
         default:
             $expression = '%(?P<objectName>[^#]+?)#(?P<objectId>[\\d]+?)$%';
             if (preg_match($expression, $chunkData['key'], $matches)) {
                 $params['where']['id'] = $matches['objectId'];
             }
             break;
     }
     switch ($params['object']) {
         case 'product':
             $dependency->tags[] = ActiveRecordHelper::getCommonTag(Product::className());
             $query = Product::find();
             if (!empty($chunkData['categoryId'])) {
                 $query->leftJoin('{{%product_category}}', Product::tableName() . '.id = {{%product_category}}.object_model_id')->andWhere(['{{%product_category}}.category_id' => $chunkData['categoryId']]);
                 $dependency->tags[] = ActiveRecordHelper::getCommonTag(Category::className());
                 $dependency->tags[] = ActiveRecordHelper::getObjectTag(Category::className(), $chunkData['categoryId']);
             }
             if (!empty($chunkData['property'])) {
                 $expression = '%(?P<propertyKey>[^:]+?):(?P<propertyValue>.+?)$%';
                 if (preg_match($expression, $chunkData['property'], $matches)) {
                     $property = Property::findOne(['key' => $matches['propertyKey']]);
                     if (!is_null($property)) {
                         /** @var Property $property */
                         $dependency->tags[] = ActiveRecordHelper::getCommonTag(Property::className());
                         $dependency->tags[] = $property->objectTag();
                         if ($property->is_eav == 1) {
                             $query->leftJoin('{{%product_eav}}', Product::tableName() . '.id = {{%product_eav}}.object_model_id')->andWhere(['{{%product_eav}}.key' => $matches['propertyKey'], '{{%product_eav}}.value' => $matches['propertyValue']]);
                         } elseif ($property->has_static_values == 1) {
                             $psv = PropertyStaticValues::findOne(['property_id' => $property->id, 'value' => $matches['propertyValue']]);
                             if (!is_null($psv)) {
                                 $dependency->tags[] = ActiveRecordHelper::getCommonTag(PropertyStaticValues::className());
                                 $dependency->tags[] = $psv->objectTag();
                                 $query->leftJoin('{{%object_static_values}}', Product::tableName() . '.id = {{%object_static_values}}.object_model_id')->andWhere(['object_id' => 3, '{{%object_static_values}}.property_static_value_id' => $psv->id]);
                             } else {
                                 return '';
                             }
                         }
                         /** @todo add column_stored */
                     } else {
                         return '';
                     }
                 }
             }
             break;
         default:
             $query = Product::find();
             break;
     }
     $params = ArrayHelper::merge($params, array_intersect_key($chunkData, $params));
     if (!empty($params['where'])) {
         $query->andWhere($params['where']);
     }
     if (!empty($params['limit'])) {
         $query->limit($params['limit']);
     }
     if ($params['type'] === 'list') {
         $view = $params['listView'];
         $objects = $query->all();
         foreach ($objects as $object) {
             $dependency->tags[] = $object->objectTag();
         }
         switch ($params['object']) {
             case 'product':
                 $viewParams = ['products' => $objects];
                 break;
             default:
                 $viewParams = ['products' => $objects];
                 break;
         }
     } else {
         $view = $params['itemView'];
         $object = $query->one();
         if (is_null($object)) {
             return '';
         }
         $dependency->tags[] = $object->objectTag();
         switch ($params['object']) {
             case 'product':
                 $viewParams = ['product' => $object, 'url' => Url::to(['@product', 'model' => $object, 'category_group_id' => $object->getMainCategory()->category_group_id])];
                 break;
             default:
                 $viewParams = ['product' => $object, 'url' => Url::to(['@product', 'model' => $object, 'category_group_id' => $object->getMainCategory()->category_group_id])];
//.........这里部分代码省略.........
开发者ID:flarmn,项目名称:dotplant2,代码行数:101,代码来源:ContentBlockHelper.php

示例9: actionAddStaticValue

 public function actionAddStaticValue($key, $value, $returnUrl, $objectId = null, $objectModelId = null)
 {
     $model = new PropertyStaticValues();
     /** @var Property $property */
     $property = Property::findOne(['key' => $key]);
     if (is_null($property)) {
         throw new NotFoundHttpException();
     }
     $model->property_id = $property->id;
     if (Yii::$app->request->isPost) {
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
             $tags = [ActiveRecordHelper::getCommonTag(Property::className()), ActiveRecordHelper::getObjectTag(Property::className(), $property->id), ActiveRecordHelper::getCommonTag(PropertyGroup::className()), ActiveRecordHelper::getObjectTag(PropertyGroup::className(), $property->property_group_id)];
             if (!is_null($objectId) && !is_null($objectModelId)) {
                 if ($property->multiple == 0) {
                     $propertyStaticValueIds = PropertyStaticValues::find()->select('id')->where(['property_id' => $property->id])->column();
                     ObjectStaticValues::deleteAll(['object_id' => $objectId, 'object_model_id' => $objectModelId, 'property_static_value_id' => $propertyStaticValueIds]);
                 }
                 $objectStaticValues = new ObjectStaticValues();
                 $objectStaticValues->attributes = ['object_id' => $objectId, 'object_model_id' => $objectModelId, 'property_static_value_id' => $model->id];
                 $objectStaticValues->save();
                 $tags[] = ActiveRecordHelper::getCommonTag(Object::findById($objectId)->object_class);
                 $tags[] = ActiveRecordHelper::getObjectTag(Object::findById($objectId)->object_class, $objectModelId);
             }
             TagDependency::invalidate(Yii::$app->cache, $tags);
             return $this->redirect($returnUrl);
         }
     } elseif ($value !== "") {
         $model->name = $value;
         $model->value = $value;
         $model->slug = Helper::createSlug($value);
         $model->sort_order = 0;
     }
     return $this->renderAjax('ajax-static-value', ['model' => $model]);
 }
开发者ID:heartshare,项目名称:dotplant2,代码行数:34,代码来源:PropertiesController.php

示例10: save


//.........这里部分代码省略.........
     }
     $class = $this->object->object_class;
     if ($objectId > 0) {
         /** @var ActiveRecord $objectModel */
         $objectModel = $class::findOne($objectId);
         if (!is_object($objectModel)) {
             if ($this->createIfNotExists === true) {
                 $objectModel = new $class();
                 $objectModel->id = $objectId;
             } else {
                 return;
             }
         }
         $objectData = [];
         foreach ($objectFields as $field) {
             if (isset($object[$field])) {
                 $objectData[$field] = $object[$field];
             }
         }
     } else {
         /** @var ActiveRecord $objectModel */
         $objectModel = new $class();
         $objectModel->loadDefaultValues();
         $objectData = $object;
     }
     if ($objectModel) {
         if ($objectModel instanceof ImportableInterface) {
             $objectModel->processImportBeforeSave($rowFields, $this->multipleValuesDelimiter, $this->additionalFields);
         }
         if ($objectModel->save()) {
             // add PropertyGroup to object
             if (!is_array($this->addPropertyGroups)) {
                 $this->addPropertyGroups = [];
             }
             foreach ($this->addPropertyGroups as $propertyGroupId) {
                 $model = new ObjectPropertyGroup();
                 $model->object_id = $this->object->id;
                 $model->object_model_id = $objectModel->id;
                 $model->property_group_id = $propertyGroupId;
                 $model->save();
             }
             if (count($this->addPropertyGroups) > 0) {
                 $objectModel->updatePropertyGroupsInformation();
             }
             $propertiesData = [];
             $objectModel->getPropertyGroups();
             foreach ($propertiesFields as $propertyId => $field) {
                 if (isset($properties[$field['key']])) {
                     $value = $properties[$field['key']];
                     if (isset($field['processValuesAs'])) {
                         // it is PSV in text
                         // we should convert it to ids
                         $staticValues = PropertyStaticValues::getValuesForPropertyId($propertyId);
                         $representationConversions = ['text' => 'name', 'value' => 'value', 'id' => 'id'];
                         $attributeToGet = $representationConversions[$field['processValuesAs']];
                         $ids = [];
                         foreach ($value as $initial) {
                             $original = $initial;
                             $initial = mb_strtolower(trim($original));
                             $added = false;
                             foreach ($staticValues as $static) {
                                 if (mb_strtolower(trim($static[$attributeToGet])) === $initial) {
                                     $ids[] = $static['id'];
                                     $added = true;
                                 }
                             }
                             if (!$added) {
                                 // create PSV!
                                 $model = new PropertyStaticValues();
                                 $model->property_id = $propertyId;
                                 $model->name = $model->value = $model->slug = $original;
                                 $model->sort_order = 0;
                                 $model->title_append = '';
                                 if ($model->save()) {
                                     $ids[] = $model->id;
                                 }
                                 //flush cache!
                                 unset(PropertyStaticValues::$identity_map_by_property_id[$propertyId]);
                                 \yii\caching\TagDependency::invalidate(Yii::$app->cache, [\devgroup\TagDependencyHelper\ActiveRecordHelper::getObjectTag(Property::className(), $propertyId)]);
                             }
                         }
                         $value = $ids;
                     }
                     $propertiesData[$field['key']] = $value;
                 }
             }
             if (!empty($propertiesData)) {
                 $objectModel->saveProperties(["Properties_{$objectModel->formName()}_{$objectModel->id}" => $propertiesData]);
             }
             if ($objectModel instanceof ImportableInterface) {
                 $objectModel->processImportAfterSave($rowFields, $this->multipleValuesDelimiter, $this->additionalFields);
             }
             if ($objectModel->hasMethod('invalidateTags')) {
                 $objectModel->invalidateTags();
             }
         } else {
             throw new \Exception('Cannot save object: ' . var_export($objectModel->errors, true) . var_export($objectData, true) . var_export($objectModel->getAttributes(), true));
         }
     }
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:101,代码来源:Import.php

示例11: isset

 * As you can see this is just a simple yii2 view file with several additional variables available
 *
 * For content rendering use $this->blocks!
 */
/**
 * @var \app\components\WebView $this
 * @var $breadcrumbs array
 * @var $model \app\modules\page\models\Page
 */
$this->params['breadcrumbs'] = $breadcrumbs;
use yii\helpers\Html;
// we need id of property that is related to todays-deals
// in production it is better to fill it statically in your template for better performance
$propertyId = \app\models\Property::getDb()->cache(function ($db) {
    return \app\models\Property::find()->where(['key' => 'todays_deals'])->select('id')->scalar($db);
}, 86400, new \yii\caching\TagDependency(['tags' => [\devgroup\TagDependencyHelper\ActiveRecordHelper::getCommonTag(\app\models\Property::className())]]));
?>

<div class="container rows-padding-top-bottom-20">
    <div class="row">
        <div class="col-md-12">
            <h1 class="text-center">
                <?php 
echo isset($this->blocks['h1']) ? $this->blocks['h1'] : Yii::t('app', 'Today\'s deals');
?>
            </h1>
            <!-- here we use ProductsWidget to show the same products as in Today's deal prefiltered page -->
            <?php 
if (intval($propertyId) > 0) {
    ?>
            <?php 
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:31,代码来源:main-page.php

示例12: getIdProperty

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdProperty()
 {
     return $this->hasOne(Property::className(), ['id' => 'id_property']);
 }
开发者ID:duvanskiy,项目名称:rubkoff,代码行数:7,代码来源:ProductProperty.php

示例13: widgetRun


//.........这里部分代码省略.........
     // Begin of a new filter sets implementation
     if ($this->useNewFilter) {
         $urlParams = ['@category', 'last_category_id' => $categoryId, 'properties' => Yii::$app->request->get('properties', []), 'category_group_id' => Yii::$app->request->get('category_group_id', 0)];
         $priceMin = empty(Yii::$app->request->post('price_min')) ? Yii::$app->request->get('price_min') : Yii::$app->request->post('price_min');
         $priceMax = empty(Yii::$app->request->post('price_max')) ? Yii::$app->request->get('price_max') : Yii::$app->request->post('price_max');
         if (false === empty($priceMin)) {
             $urlParams['price_min'] = $priceMin;
         }
         if (false === empty($priceMax)) {
             $urlParams['price_max'] = $priceMax;
         }
         $urlParams = $this->mergeUrlProperties($urlParams, ['properties' => Yii::$app->request->post('properties', [])]);
         $urlParams = $this->removeLostDependencies($filterSets, $urlParams);
         $properties = $urlParams['properties'];
         $newGet = Yii::$app->request->get();
         $newGet['properties'] = $properties;
         Yii::$app->request->setQueryParams($newGet);
         ksort($properties);
         $cacheKey = 'FilterSets:' . $categoryId . ':' . json_encode($urlParams);
         unset($properties);
         if (false === ($filtersArray = Yii::$app->cache->get($cacheKey))) {
             $filtersArray = [];
             foreach ($filterSets as $filterSet) {
                 /** Если eav и слайдер, то фильтр формируется по особым правилам */
                 if ($filterSet->is_range_slider && $filterSet->property->is_eav) {
                     $filter = $this->getEavSliderFilter($filterSet->property, $urlParams);
                     if ($filter) {
                         $filtersArray[] = $filter;
                     }
                     continue;
                 } elseif ($filterSet->property->has_static_values === 0) {
                     continue;
                 }
                 if (!empty($filterSet->property->depends_on_property_id) && !empty($filterSet->property->depended_property_values)) {
                     if ($this->getSelectedPropertyIndex($urlParams['properties'], $filterSet->property->depends_on_property_id, $filterSet->property->depended_property_values) === false) {
                         continue;
                     }
                 }
                 $selections = PropertyStaticValues::getValuesForFilter($filterSet->property->id, $urlParams['last_category_id'], $urlParams['properties'], $filterSet->multiple, Yii::$app->getModule('shop')->filterOnlyByParentProduct);
                 if (count($selections) === 0) {
                     continue;
                 }
                 $item = ['id' => $filterSet->property->id, 'name' => $filterSet->property->name, 'sort_order' => $filterSet->property->sort_order, 'isRange' => $filterSet->is_range_slider, 'selections' => [], 'multiple' => $filterSet->multiple];
                 if ($filterSet->is_range_slider) {
                     $item['max'] = 0;
                     $item['min'] = PHP_INT_MAX;
                     $item['property'] = $filterSet->property;
                 }
                 foreach ($selections as $selection) {
                     if ($filterSet->is_range_slider) {
                         if ((int) $selection['value'] > $item['max']) {
                             $item['max'] = (int) $selection['value'];
                         }
                         if ((int) $selection['value'] < $item['min']) {
                             $item['min'] = (int) $selection['value'];
                         }
                     } else {
                         $selectedPropertyIndex = $this->getSelectedPropertyIndex($urlParams['properties'], $filterSet->property_id, $selection['id']);
                         if ($selectedPropertyIndex !== false) {
                             if (count($urlParams['properties'][$filterSet->property_id]) > 1) {
                                 $routeParams = $urlParams;
                                 unset($routeParams['properties'][$filterSet->property_id][$selectedPropertyIndex]);
                             } else {
                                 $routeParams = $urlParams;
                                 unset($routeParams['properties'][$filterSet->property_id]);
                             }
                             if (isset($this->toUnset[$filterSet->property_id])) {
                                 foreach ($this->toUnset[$filterSet->property_id] as $id) {
                                     unset($routeParams['properties'][$id]);
                                 }
                             }
                         } else {
                             $routeParams = $this->mergeUrlProperties($urlParams, ['properties' => [$filterSet->property_id => [$selection['id']]]]);
                         }
                         $item['selections'][] = ['id' => $selection['id'], 'checked' => $selectedPropertyIndex !== false, 'label' => $selection['name'], 'url' => $selection['active'] === true || $selectedPropertyIndex !== false ? Url::toRoute($routeParams) : null, 'active' => $selection['active']];
                     }
                 }
                 if ($filterSet->is_range_slider) {
                     if ($item['min'] === $item['max']) {
                         continue;
                     }
                     $i = 1;
                     $n = $item['max'] - $item['min'];
                     while ($n >= 10) {
                         $n = $n / 10;
                         $i++;
                     }
                     $item['step'] = $i > 3 ? (int) pow(10, $i - 3) : 1;
                     unset($i, $n);
                 }
                 $filtersArray[] = $item;
                 unset($item);
             }
             Yii::$app->cache->set($cacheKey, $filtersArray, 86400, new TagDependency(['tags' => [ActiveRecordHelper::getCommonTag(FilterSets::className()), ActiveRecordHelper::getCommonTag(Product::className()), ActiveRecordHelper::getCommonTag(Property::className())]]));
         }
         return $this->render($this->viewFile, ['filtersArray' => $filtersArray, 'id' => 'filter-set-' . $this->id, 'urlParams' => $urlParams, 'usePjax' => $this->usePjax]);
     }
     // End of a new filter sets implementation
     return $this->render($this->viewFile, ['filterSets' => $filterSets, 'id' => 'filter-set-' . $this->id, 'hideEmpty' => $this->hideEmpty]);
 }
开发者ID:lzpfmh,项目名称:dotplant2,代码行数:101,代码来源:Widget.php

示例14: down

 public function down()
 {
     $this->delete(Object::tableName(), ['object_class' => [Property::className(), PropertyStaticValues::className()]]);
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:4,代码来源:m150326_103656_property_image.php


注:本文中的app\models\Property::className方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。