Esempio n. 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGoods($categoryId = null)
 {
     $query = $this->hasMany(Goods::className(), ['store_id' => 'id'])->where(['status' => Goods::STATUS_NORMAL]);
     if ($categoryId !== null) {
         $query->andWhere(['category_id' => $categoryId]);
     }
     return $query->orderBy(['is_promotion' => SORT_DESC, 'is_hot' => SORT_DESC, 'sales' => SORT_DESC, 'name' => SORT_ASC]);
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGoods()
 {
     return $this->hasOne(Goods::className(), ['id' => 'goods_id']);
 }
Esempio n. 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGoods()
 {
     return $this->hasMany(Goods::className(), ['cat_id' => 'cat_id']);
 }