I'm new to OOP and am getting a handle on Objects which store all the properties and functions/methods which make up and deal with an instance of the Object (singular) but where should functions that deal with multiples sit?
For example lets say we have a database table "Books" which stores all the details of a book. I then have a class with all the columns from the table as properties and some methods to retrieve, manipulate and save details about a (single) book.
Multiple parts of the site need to list all the books so it makes sense to create a function getAllBooks() but where should this go? Does it go in the Books class, maybe as a static method, or somewhere else, and if so where? Putting it in the Books class makes sense as it keeps all the book related code in one place but on the other hand we now have a function that deals with multiple books sitting in a class designed to deal with a single book, so I'm not sure how this is normally done.
Thanks in advance.