Пример #1
0
 /**
  * Displays a single Friends model.
  * @param string $userOne
  * @param string $userTwo
  * @return mixed
  */
 public function actionView($user)
 {
     $model = User::find()->where('username = :username', [':username' => $user])->one();
     $owner_id = $model["id"];
     $dataProvider = new ActiveDataProvider(['query' => Album::find()->where(['owner_id' => '' . $owner_id, 'shareable' => '1'])]);
     $query = new Query();
     $dataProviderOne = new ActiveDataProvider(['query' => $query->select("*")->from('album')->innerJoin('yetki', 'yetki.id' . '=' . 'album.id')->where('owner_id = ' . $owner_id)]);
     return $this->render('view', ['dataProvider' => $dataProvider, 'dataProviderOne' => $dataProviderOne]);
 }
Пример #2
0
 /**
  * Finds the Album model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Album the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Album::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAlbums()
 {
     return $this->hasMany(Album::className(), ['owner_id' => 'id']);
 }
Пример #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAlbum()
 {
     return $this->hasOne(Album::className(), ['id' => 'album_id']);
 }