I have the following tables
app language app_info
app_info has a foreign key of app and language tables
I want bring a only result of appinfo which has the same idlanguage, not all, but the query returns me all the appinfo which are related with idapp.
$app = $this->modelsManager->createBuilder() ->from(['a' => 'App']) ->join('AppInfo', 'a.id_app = AppInfo.id_app_fk_app_info') ->where('a.id_app = :id_app:') ->andWhere('AppInfo.id_lang_available_fk_app_info = :id_lang:') ->groupBy('a.id_app') ->getQuery() ->execute(['id_app' => 12, 'id_lang' => 1]) ->getFirst(); $this->view->app = $app;
Directly in MySQL Workbench when i use the following SQL works like i want
select * from app a join app_info ai on a.id_app = ai.id_app_fk_app_info where a.id_app = 12 and ai.id_lang_available_fk_app_info = 1 group by a.id_app