This happens because in child classes you are overriding BaseModel
initialize
method.
If you want to extend initilize
in child class you should call initialize from parent class - here BaseModel
.
Model A/B should be:
class Model_b extends Basemodel {
public $b;
function initialize() {
parent::initialize(); // Call parent's class initialize
$this->b = 'someName';
}
function rawtext() {
return $this->name; // SHOULD WORK
}
}