A code snippet is on the PHP manual page for extends that should be of interest to you:
PHP does not allow for multiple intheritance. You could take a look at decorator pattern which is kind of multiple inheritance, but I don't think that the stuff you want to do will be that easy to do. Maybe something like this:
class Extended extends APlainPHPModelFromLibrary{
protected $model;
public function __construct(Model $model){ //Illuminate\Database\Eloquent\Model
$this->model = $model;
}
public function __call($name, $arguments){
call_user_func_array([$this->model, $name], $arguments);
}
}
This way you would most likely be allowed to use method from Eloquent if it does not appear in your APlainPHPModelFromLibrary
. You could do same for getters and setters. It is kind of tricky and I don't say it is most optimal solution since I don't know what exacly you need. Maybe someone will give you some better clue.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community