Answer the question
In order to leave comments, you need to log in
Will this functionality be redundant for the class?
There is a Game class that is a video game, as well as a GameMapper that pulls information from the database and returns an object of the Game class. There are also similar Post and PostMapper classes, respectively. So, since a game can have news that belongs only to this game, you should set the posts property and store a collection of post objects there. Having previously implemented PostMapper in the GameMapper's property, wouldn't that be redundant? Currently implemented as follows:
$game=$container->make('GameMapper')->find($uri);// Вытаскиваю из базы игру по запрошенному uri
View::render
( 'single',
[
'game'=>$game,
'posts'=>$container->make('PostMapper')->find_posts_for_game($game->id())// Вытаскиваю новости по id игры
]
);
View::render
( 'single',
[
'game'=>$game=$container->make('GameMapper')->find($uri);// Вытаскиваю из базы игру по запрошенному uri
]
);
Answer the question
In order to leave comments, you need to log in
wouldn't that be redundant?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question