Esempio n. 1
0
 public static function getImgs($data)
 {
     $query = Img::find()->limit(!empty($data['limit']) ? $data['limit'] : 40)->orderBy('id DESC');
     if (!empty($data['userId'])) {
         $query->andWhere('user_id = :user_id', [':user_id' => $data['userId']]);
     }
     return $query->all();
 }
Esempio n. 2
0
 /**
  * @return Img[]
  */
 public function getImgsSort()
 {
     $query = Img::find()->innerJoin(EntityLink::tableName(), Img::tableName() . '.id = `' . EntityLink::tableName() . '`.entity_2_id')->andWhere(['entity_1' => self::THIS_ENTITY, 'entity_2' => Img::THIS_ENTITY, 'entity_1_id' => $this->id])->orderBy(['sort' => SORT_ASC]);
     return $query->all();
 }