Lets i have two classes: Posts and Comments mapping the Posts and Comments tables from the database.
I want to get all coments from a specific post.
Should I make post->getAllComments() or comments->getByPostID(postid).
I have one class representing each table and one class represent each row of that table.
What do you think is the best way?
As the comments class is mapping comments from the database, I'd say you should use Comments->getByPostID(postid).
Of course, if the Post class has access to the Comments class, then by all means use Post->getAllComments() as a helper method which simply calls Comments->getByPostID(Post->ID).
Can't have too many helper methods
It may be important to note, however, that it is useful to have the actual record class (i.e. Post, where Posts is the mapper class) unassociated from the database/mappers entirely. That way moving records to alternative database systems (e.g. a backup system) will take much less code. Post->getAllComments() implies that Post has access to the database connection, which (depending on your system design) may not be the best approach.