Esempio n. 1
0
 /**
  * Main function for getting Type objects. Tries caches and instantiates new objects if necessary.
  *
  * @param int $id of requested Type
  *
  * @return \iveeCore\Type the requested Type or subclass object
  * @throws \iveeCore\Exceptions\TypeIdNotFoundException if the typeID is not found
  */
 public static function getById($id)
 {
     if (!isset(static::$instancePool)) {
         static::init();
     }
     $id = (int) $id;
     try {
         return static::$instancePool->getObjById($id);
     } catch (Exceptions\KeyNotFoundInCacheException $e) {
         //go to DB
         $type = self::factory($id);
         //store SdeTypeCommon object in instance pool (and cache if configured)
         static::$instancePool->setObj($type);
         return $type;
     }
 }