I'm using Yii2 and doing a site project where one of the features is to list the movies bound to a specific user. I already have a method to associate the movies with the accounts and one that does the inner join of the tables.
(Actions Code):
public function actionAssociarFilme($idFilme){
$model = new FilmeHasCompra();
$model->Filme_idFilme = $idFilme;
$model->Usuario_idUsuario = Yii::$app->user->identity->idUsuario;
$model->save();
return $this->goBack();
}
public function actionListarFilme(){
$resultado = Filme::find()
->innerJoin('filme_has_compra', 'filme_has_compra.Filme_idFilme=Filme.idFilme')
->where('filme_has_compra.Usuario_idUsuario=:idusuario',['idusuario'=>Yii::$app->user->identity->idUsuario]) ->all();
return $this->render('tables',['resultado'=>$resultado]);
}
}
The question is how to call this action ListarFilme in the view, because when I try to call it it appears a unknown method error