Example #1
0
 public static function model($model = null)
 {
     if ($model) {
         static::$_model = $model;
     }
     return static::$_model;
 }
Example #2
0
 /**
  * _loadModel
  *
  * Load the model instance, using the configured settings
  * If configured to not use a table, or attempting to load the model fails - return false
  *
  * @return void
  */
 protected static function _loadModel()
 {
     if (!static::$_config['useTable']) {
         return false;
     }
     if (static::$_model) {
         return true;
     }
     try {
         static::$_model = ClassRegistry::init(array('class' => 'Translations.Translation', 'table' => static::$_config['useTable'], 'ds' => static::$_config['useDbConfig']));
         static::$_model->setSource(static::$_config['useTable']);
     } catch (Exception $e) {
         static::$_config['useTable'] = false;
         return false;
     }
     return true;
 }