public static function findByProjectId($projectId) { $documents = parent::findByProjectId($projectId); $documentsWithInfo = array(); foreach ($documents as $d) { $information = DocumentsInformation::find(array("documentId=" . $d->id, "order" => "uploadDate DESC", "limit" => 3)); $documentsWithInfo[$d->id] = $information->toArray(); } return $documentsWithInfo; }