/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return AlbumImage the loaded model * @throws CHttpException */ public function loadModel($id) { $model = AlbumImage::model()->with('image')->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Get Associated Album Images. * @return array AlbumImage */ public function getImages() { return AlbumImage::model()->with('image')->findAllByAttributes(['album_id' => $this->id]); }