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


PHP ActiveQuery::innerJoin方法代码示例

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


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

示例1: filter

 public function filter(ActiveQuery $query, &$cacheKeyAppend)
 {
     $get = Yii::$app->request->post();
     if (isset($get['changeValue']) && is_array($get['changeValue'])) {
         foreach ($get['changeValue'] as $propertyId => $isActive) {
             if ($isActive && isset($get[$this->minValueAttribute][$propertyId]) && isset($get[$this->maxValueAttribute][$propertyId]) && is_numeric($get[$this->minValueAttribute][$propertyId]) && is_numeric($get[$this->maxValueAttribute][$propertyId])) {
                 $query->innerJoin('object_static_values as osvf' . $propertyId, 'product.id=osvf' . $propertyId . '.object_model_id');
                 $query->innerJoin('property_static_values as psvf' . $propertyId, 'psvf' . $propertyId . '.id=osvf' . $propertyId . '.property_static_value_id');
                 $query->andWhere('psvf' . $propertyId . '.value >= :minData ')->andWhere('psvf' . $propertyId . '.value <= :maxData ')->andWhere(['psvf' . $propertyId . '.property_id' => $propertyId])->addParams([':minData' => (int) $get[$this->minValueAttribute][$propertyId], ':maxData' => (int) $get[$this->maxValueAttribute][$propertyId]]);
                 $cacheKeyAppend .= 'FilterRangeProperty[min:' . (int) $get[$this->minValueAttribute][$propertyId] . ':max' . (int) $get[$this->maxValueAttribute][$propertyId] . ']';
             }
         }
     }
     return $query;
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:15,代码来源:FilterRangeProperty.php

示例2: filter

 public function filter(ActiveQuery $query, &$cacheKeyAppend)
 {
     $get = Yii::$app->request->post();
     if (isset($get['changeValue']) && is_array($get['changeValue'])) {
         foreach ($get['changeValue'] as $propertyId => $isActive) {
             if ($isActive && isset($get[$this->minValueAttribute][$propertyId]) && isset($get[$this->maxValueAttribute][$propertyId]) && is_numeric($get[$this->minValueAttribute][$propertyId]) && is_numeric($get[$this->maxValueAttribute][$propertyId])) {
                 $property = Property::findById($propertyId);
                 if ($property->has_static_values) {
                     $query->innerJoin('{{%object_static_values}} as osvf' . $propertyId, '{{%product}}.id=osvf' . $propertyId . '.object_model_id');
                     $query->innerJoin('{{%property_static_values}} as psvf' . $propertyId, 'psvf' . $propertyId . '.id=osvf' . $propertyId . '.property_static_value_id');
                     $query->andWhere('psvf' . $propertyId . '.value >= :minData ')->andWhere('psvf' . $propertyId . '.value <= :maxData ')->andWhere(['psvf' . $propertyId . '.property_id' => $propertyId])->addParams([':minData' => (int) $get[$this->minValueAttribute][$propertyId], ':maxData' => (int) $get[$this->maxValueAttribute][$propertyId]]);
                 } elseif ($property->is_eav) {
                     $query->innerJoin('{{%product_eav}} as peav' . $propertyId, '{{%product}}.id=peav' . $propertyId . '.object_model_id');
                     $query->andWhere(['peav' . $propertyId . '.property_group_id' => $property->property_group_id, 'peav' . $propertyId . '.key' => $property->key]);
                     $query->andWhere(['>=', 'peav' . $propertyId . '.value', (int) $get[$this->minValueAttribute][$propertyId]]);
                     $query->andWhere(['<=', 'peav' . $propertyId . '.value', (int) $get[$this->maxValueAttribute][$propertyId]]);
                 }
                 $cacheKeyAppend .= 'FilterRangeProperty:propertyId' . $propertyId . ':[min:' . (int) $get[$this->minValueAttribute][$propertyId] . ':max' . (int) $get[$this->maxValueAttribute][$propertyId] . ']';
             }
         }
     }
     return $query;
 }
开发者ID:lzpfmh,项目名称:dotplant2,代码行数:23,代码来源:FilterRangeProperty.php


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