"preConstructor" , , , , .
:
class test
{
protected $executeConstructor;
public function __construct()
{
$this->executeConstructor = true;
if (method_exists($this, "preConstruct"))
{
$this->preConstruct();
}
if ($this->executeConstructor == true)
{
// regular constructor code
}
}
}
public function subTest extends test
{
public function preConstruct ()
{
$ this-> executeConstructor = false;
}
}
source
share