public function actionUpdate($id)
 {
     $book = Book::findOne($id);
     $categorys = Category::find()->orderBy('name')->all();
     $categoryIds = ArrayHelper::map($categorys, 'id', 'name');
     $userbook = Userbook::find()->orderBy('id_user')->all();
     $userIds = ArrayHelper::map($userbook, 'id_user', 'name_user');
     return $this->render('//Book/Form', ['book' => $book, 'icon' => 'glyphicon glyphicon-pencil', 'title' => 'Edit Book', 'categoryIds' => $categoryIds, 'userIds' => $userIds]);
 }
Beispiel #2
0
 public function getUserbook()
 {
     return $this->hasOne(Userbook::className(), ['id_user' => 'id_user']);
 }