I try to get the relation but when i use custom columns it doesn't work, for example
MODEL
public function initialize(){
$this->hasManyToMany(
"id",
'Models\Movies\MoviesGenres',
"movie_id",
"genre_id",
'Models\Movies\Genres',
"id",
['alias' => 'genres']
);
}
CODE
// THIS WORKS
$movies = Movies::find(["limit" => "10"]);
foreach ($movies as $movie){
var_dump($movies->genres); // WORKS
}
// THIS DOESN'T WORK
$movies = Movies::find(["columns" => "id, title", "limit" => "10"]);
foreach ($movies as $movie){
var_dump($movies->genres); // DOESN'T WORK :C
}
What can i do?, i don't need all columns for example in this case i just need the title, but also need the genres.
Thanks.