/** * 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 Stores the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Stores::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
function examplesMenu() { Yii::import("application.modules.stores.models.Stores", true); Yii::import("application.modules.examples.models.Examples", true); $store_limit = Yii::app()->params['store_example_limit']; $example_limit = Yii::app()->params['before_after_limit']; $stores_examples = Stores::model()->findAll(array('limit' => "{$store_limit}", 'order' => "sequence", "condition" => "publish = 1 AND store_type='example' AND deleted = 0 ")); $examples = Examples::model()->findAll(array("condition" => "publish = 1 AND status = 1 AND deleted = 0 LIMIT {$example_limit}")); return array('stores' => $stores_examples, 'examples' => $examples); }