コード例 #1
0
ファイル: Types.php プロジェクト: jtietema/Fizzy
 public static function initialize(Zend_Config $config)
 {
     if (null !== self::$_instance) {
         throw new Fizzy_Exception('Can\'t call Fizzy_Type::initialize twice.');
     }
     self::$_instance = new self($config);
     return self::$_instance;
 }
コード例 #2
0
ファイル: Comments.php プロジェクト: jtietema/Fizzy
 /**
  * Returns the model where the comments are attached to.
  * It uses the post_id field, which follows the convention <type>:<id>
  * The type references a model in the config and the id, well an id.
  *
  * @return Doctrine_Record|null
  */
 public function getThreadModel()
 {
     if (false === strpos($this->post_id, ':')) {
         return null;
     }
     list($type, $id) = explode(':', $this->post_id);
     $types = Fizzy_Types::getInstance();
     if (!$types->hasType($type) && null === $types->getTypeModel($type)) {
         return null;
     }
     $modelName = $types->getTypeModel($type);
     $query = Doctrine_Query::create()->from($modelName)->where('id = ?', $id);
     $model = $query->fetchOne();
     return $model;
 }
コード例 #3
0
ファイル: Bootstrap.php プロジェクト: jtietema/Fizzy
 protected function _initTypes()
 {
     $config = new ZendL_Config_Yaml(ROOT_PATH . '/configs/types.yml');
     $types = Fizzy_Types::initialize($config);
     return $types;
 }