public static function current() { if (self::$objs === NULL) { self::$objs = new SuperObjects(); } return self::$objs; }
/** * Get the super object of this object * * Depending on what type of relationships you have set up in your constructor, * a DbObject might have a super object set on it during a fetch operation. * * @return DbObject - the super object of this object * @access public * @see setSuperObject,support,depend,specialise,generalise */ public function superObject() { $this->read(); try { $ret = SuperObjects::current()->object($this); } catch (Exception $exc) { $ret = NULL; foreach ($this->rels as $class => $rel) { if ($rel == DbObject::SPECIALISE_REL) { $obj = new $class(); $keys = $this->primaryKeys(); foreach ($keys as $key) { $obj->clause($key->name(), $key->value()); } $obj->read(); $obj->add($this); //$this->super_object = $obj; SuperObjects::current()->addObject($this, $obj); $ret = $obj; } } } //return $this->super_object; return $ret; }