[OOP] Simple question, which is better?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: [OOP] Simple question, which is better?

Post by Christopher »

lorenzo-s wrote:My question is: where I should put the method getCommentsForPhoto()? In the Photo class or in the Comment class as getCommentsForPhoto($photo_id)? Which is more correct?
I think lorenzo-s has given us a simple rule ... if you have a method that end with ForFoo() like getCommentsForPhoto($photo_id) then probably it should be $Photo->getComments($photo_id).
(#10850)
Post Reply