Beispiel #1
0
 public function actionProductdetail($id = null)
 {
     if ($id !== null || $id !== 0) {
         $product = Productmedias::find()->with('product')->where('ProductId = ' . $id)->asArray()->one();
     } else {
     }
     return $this->render('productdetail', ['product' => $product]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Productmedias::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['ProductMediaId' => $this->ProductMediaId, 'ProductId' => $this->ProductId, 'DisplayOrder' => $this->DisplayOrder, 'IsVideo' => $this->IsVideo, 'IsPrimary' => $this->IsPrimary, 'IsActive' => $this->IsActive, 'created_by' => $this->created_by, 'LastUpdatedBy' => $this->LastUpdatedBy, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at, 'deleted_at' => $this->deleted_at]);
     $query->andFilterWhere(['like', 'SmallImageUrl', $this->SmallImageUrl])->andFilterWhere(['like', 'ImageUrl', $this->ImageUrl])->andFilterWhere(['like', 'ZoomImageUrl', $this->ZoomImageUrl])->andFilterWhere(['like', 'EmbedCode', $this->EmbedCode])->andFilterWhere(['like', 'HtmlAlt', $this->HtmlAlt])->andFilterWhere(['like', 'HtmlTitle', $this->HtmlTitle])->andFilterWhere(['like', 'FeaturedText', $this->FeaturedText])->andFilterWhere(['like', 'Comment', $this->Comment]);
     return $dataProvider;
 }
 /**
  * Finds the Productmedias model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Productmedias the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Productmedias::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProductmedias()
 {
     return $this->hasMany(Productmedias::className(), ['ProductId' => 'ProductId']);
 }