Esempio n. 1
0
 /**
  * @param string $userId
  * @return ConversationQuery
  * @throws \yii\base\InvalidConfigException
  */
 public static function conversations($userId)
 {
     /**@var ConversationQuery $query * */
     $query = \Yii::createObject(ConversationQuery::className(), [get_called_class(), ['userId' => $userId]]);
     return $query->with(['newMessages' => function ($msg) use($userId) {
         /**@var $msg ConversationQuery * */
         $msg->andOnCondition(['receiver_id' => $userId])->select(['sender_id', 'COUNT(*) AS count']);
     }]);
 }
Esempio n. 2
0
 /**
  * @return ConversationQuery
  * @throws \yii\base\InvalidConfigException
  */
 public static function find()
 {
     return Yii::createObject(ConversationQuery::className(), [get_called_class()]);
 }
Esempio n. 3
0
 /**
  * @param string $userId
  * @return ConversationQuery
  * @throws \yii\base\InvalidConfigException
  */
 public static function conversations($userId)
 {
     return \Yii::createObject(ConversationQuery::className(), [get_called_class(), ['userId' => $userId]]);
 }