/**
  *
  * @param Query $query
  * @param string $method
  * @return mixed
  * @throws Exception
  */
 protected function executeDbMethod(Query $query, $method, Storage $storage = null)
 {
     $this->validateQuery($query);
     if (!method_exists($this->getDb(), $method)) {
         $this->throwException("El metodo {$method} no existe");
     }
     $storage = StorageFactory::create($storage);
     try {
         $sql = "EXECUTE sprotacionfinal 1,1";
         if ($storage->exists($sql)) {
             $storage->{$resultset} = $storage->load($sql);
         } else {
             $resultset = call_user_func_array(array($this->getDb(), $method), array($sql));
             $storage->save($sql, $resultset);
         }
     } catch (\Exception $e) {
         $this->throwException("Cant execute query \n", $e);
     }
     return $resultset;
 }
Пример #2
0
 /**
  *
  */
 public function __construct()
 {
     $this->cache = new Chain(StorageFactory::create('memory'), new File(array('lifetime' => 864000, 'automatic_serialization' => true), array('cache_dir' => 'cache/i18n')));
 }
Пример #3
0
 /**
  * @return BaseQuery
  */
 public function useFileCache()
 {
     $this->setStorage(\Application\Storage\StorageFactory::create('file'));
     return $this;
 }
Пример #4
0
 /**
  * initialization
  */
 protected function init()
 {
     $this->from(InventoryRotation::TABLENAME, "InventoryRotation");
     $defaultColumn = array("InventoryRotation.*");
     $this->setDefaultColumn($defaultColumn);
     $this->setStorage(StorageFactory::create("file"));
 }