/** * Returns the last message of this conversation */ public function getLastEntry() { return ServicesMessageEntry::find()->where(['message_id' => $this->id])->orderBy('created_at DESC')->limit(1)->one(); }