I have an abstract "object" class that provides basic CRUD functionality along with validation, etc. Typically I would use the __autoload($name) magic function to load a class that would exist in its own file, named the same as the class I wish to lazy load. The code would look something like this, which as you can imagine becomes quite repetitive.
final class bicycle extends object {
public function __construct($id=null) {
parent::__construct($id, __CLASS__);
}
public function __toString() {
return($this->name);
}
}
My question is whether or not I can somehow dynamically generate these classes on the fly so I don't have to create the same functionality over and over - thus reducing overhead and design time. Does PHP5 even support this or am I simply overestimating the power of OO PHP?
Thanks!