I have an entity that has a one-to-many association (many-to-many with extra fields):
class Game { /** /* @OneToMany(targetEntity="GamePlayer", mappedBy="game", cascade={"persist"}) /* @JoinColumn(name="id", referencedColumnName="game_id", onDelete="cascade") */ private $gamePlayer; }
The class has an automated getter for all authors: getGamePlayers ()
I would like to add a filter to it, so it will only query the database for the relevant details in the most efficient way:
public function getGamePlayersWithScoreHigherThan($score){
What is the best way to get such a getter from within an object (without using a repository)?
Many thanks!
Koby
source share