19 declare(strict_types=1);
37 $this->instances = array();
42 if (self::$instance ===
null) {
45 return self::$instance;
54 if (!array_key_exists($ref_id, $this->instances)) {
56 if ($type ===
'prg') {
59 if ($type ===
'prgr') {
61 $this->instances[
$ref_id] = $prg_reference->getReferencedObject();
63 if ($type !==
'prgr' && $type !==
'prg') {
64 throw new \Exception(
'invalid ref_id: ' . $ref_id);
67 return $this->instances[
$ref_id];
73 throw new ilException(
"ilObjStudyProgrammeCache::addInstance: Can't add instance without ref_id.");
75 $this->instances[$prg->
getRefId()] = $prg;
85 $this->instances = array();
90 return count($this->instances) === 0;
Cache for ilObjStudyProgrammes.
static ilObjStudyProgrammeCache $instance
getInstanceByRefId(int $ref_id)
addInstance(ilObjStudyProgramme $prg)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
test_clear()
For testing purpose.
static _lookupType(int $id, bool $reference=false)