Exemple #1
0
 public function __call($function, $args)
 {
     switch (true) {
         case preg_match('/^fetchBy[A-Z]/', $function):
             $field = preg_replace('/^fetchBy/', '', $function);
             $field = Monday_Model::functionToField($field);
             return $this->fetchSpecificField($field, $args);
             break;
     }
     throw new Exception('Incorrect function call');
 }
Exemple #2
0
 public static function service($class, $namespace = null)
 {
     $class = ucfirst($class);
     // Generella services finns inte, men ibland vill vi cacha
     $className = "Service_" . Monday_Model::fieldToFunction($class);
     $service = self::load($className, $namespace);
     return $service;
 }
Exemple #3
0
 public function delete(Monday_Model $model)
 {
     $table = $this->getTable();
     $info = $table->info();
     $primaryGetter = 'get' . Monday_Model::fieldToFunction(array_pop($info['primary']));
     $row = $table->find($model->{$primaryGetter}())->current();
     if ($row) {
         $row->delete();
     }
 }