Answer the question
In order to leave comments, you need to log in
How to get multiple objects of the same model?
There is a simple class
class Book
{
public $id;
public $name;
public function __construct(int $id, string $name){
$this->id = $id;
$this->name = $name;
}
//и тд.
}
Answer the question
In order to leave comments, you need to log in
And it is possible, by changing the class, to return a set of objects inside the given one.
If you make a class a la model, in which to implement the search for a set of objects, and expand it with the Book class, then - quite yes. But, I suspect, that's what you meant by "In conjunction with the collection class".
Definitely the first option.
For searching collections, single objects, and in general for CRUD, it is better to look towards DataMapper - it abstracts model objects from the DBMS. It is very comfortable:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question