Hi, I am trying to find a way to easyly join tables through phalcon to fetch data related to 1 object in 1 query.
I have these relation ships in my models
$this->hasMany("playerid", "Vehicles", "pid"); $this->hasMany("playerid", "Houses", "pid" ); $this->belongsTo("playerid","Gangs","owner");
I wonder if their is a way to tell phalcon to automaticly join these tables when i do
Players::findFirstByPlayerid($id) other frameworks have a method
->with(["table1","table2"]) is there anything simular in phalcon apart from building the query manually?
atm i am doing
$player = Players::findFirstByPlayerid($id); $this->view->player = $player; $this->view->player->bankacc = $this->formatBank($player->bankacc); $this->view->player->vehicles = $player->getVehicles('alive = 1'); $this->view->player->houseCount = $player->houses->count();
Currently 3 queries are being made: https://blackfire.io/profiles/3bac4bd9-87e1-46ce-87e2-325329966cd3/graph?settings%5Bdimension%5D=wt&settings%5Bdisplay%5D=focused&settings%5BtabPane%5D=nodes&selected=&callname=%40sql.queries it would be great if I can cut this down to 1 using the joins