Ik heb een singleton core class met daarin een functie addClass waarmee je classes kan toevoegen:
$core->addClass($classname, $useParameters, $parameters);
Maar nu zit ik met een probleem. In elke class die ik in ga laden via die core class zit een publieke var core die de instantie van de core moet gaan bevatten.
In de functie $core->addClass heb ik aan het einde deze code:
$this->$classname->core = self::getInstance();
// Add the instance of the core to the class
En dit is de functie getInstance():
public static function getInstance($siteURL = '', $basepath = '', $classpath = ''){
if(!isset(self:: $instance)){
self:: $instance = new core($siteURL, $basepath, $classpath);
}
// If the instance does not exists yet, create one.
return self:: $instance;
// Return the instance
}
// Create and return the instance
Alleen nu wordt die $this->$classname->core niet gevuld met die core variable....
Iemand enig idee waarom?
$core->addClass($classname, $useParameters, $parameters);
Maar nu zit ik met een probleem. In elke class die ik in ga laden via die core class zit een publieke var core die de instantie van de core moet gaan bevatten.
In de functie $core->addClass heb ik aan het einde deze code:
$this->$classname->core = self::getInstance();
// Add the instance of the core to the class
En dit is de functie getInstance():
public static function getInstance($siteURL = '', $basepath = '', $classpath = ''){
if(!isset(self:: $instance)){
self:: $instance = new core($siteURL, $basepath, $classpath);
}
// If the instance does not exists yet, create one.
return self:: $instance;
// Return the instance
}
// Create and return the instance
Alleen nu wordt die $this->$classname->core niet gevuld met die core variable....
Iemand enig idee waarom?






