Page 2 of 2

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

Posted: Tue Sep 22, 2009 1:30 pm
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).