Answer the question
In order to leave comments, you need to log in
Setter in constructor?
Whether the design is adequate:
A piece of code from the news model is shown, the base model comes to the constructor. The base model, like the news model, implements the ModelInterface.
public function __construct(ModelInterface $model) {
$this->setTable('news');
$this->model = $model;
}
private function setTable($table) {
$this->table = BaseModel::PREFIX . $table;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question