Commit with composer.json
This commit is contained in:
@ -10,20 +10,22 @@
|
||||
* @since 2010-02-16
|
||||
*/
|
||||
|
||||
namespace Majestic;
|
||||
|
||||
abstract class Model
|
||||
{
|
||||
|
||||
/**
|
||||
* DbDriver instance
|
||||
*
|
||||
* @var DbDriver
|
||||
* @var \DbDriver
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Cache instance
|
||||
*
|
||||
* @var Cache
|
||||
* @var \Cache
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
@ -48,7 +50,7 @@ abstract class Model
|
||||
|
||||
public function __construct($connection = 'default')
|
||||
{
|
||||
$this->db = Db::connect($connection);
|
||||
$this->db = \Majestic\Db::connect($connection);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,12 +96,12 @@ abstract class Model
|
||||
/* Cache workaround */
|
||||
|
||||
/**
|
||||
* @return Cache
|
||||
* @return \Cache
|
||||
*/
|
||||
public function getCache()
|
||||
{
|
||||
if (!$this->cache) {
|
||||
$this->cache = Cacher::get(Config::get(__CLASS__, 'MemcacheCache'));
|
||||
$this->cache = \Cacher::get(Config::get(__CLASS__, 'MemcacheCache'));
|
||||
}
|
||||
return $this->cache;
|
||||
}
|
||||
@ -107,16 +109,16 @@ abstract class Model
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $params
|
||||
* @return CacheKey
|
||||
* @return \CacheKey
|
||||
*/
|
||||
protected function cacheKey($name, $params = array())
|
||||
{
|
||||
$expire = (isset($this->cache_keys[$name])) ? ($this->cache_keys[$name] * 60) : 0;
|
||||
return new CacheKey($this->getCache(), $name, $params, $expire);
|
||||
return new \CacheKey($this->getCache(), $name, $params, $expire);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CacheKey $cache
|
||||
* @param \CacheKey $cache
|
||||
*/
|
||||
protected function addCleanCache($cache)
|
||||
{
|
||||
@ -152,21 +154,21 @@ abstract class Model
|
||||
* @param string $data Request
|
||||
* @param array $params Request parameters
|
||||
* @param string $field Requested field name
|
||||
* @param CacheKey $cache_key Key for caching in
|
||||
* @param \CacheKey $cache_key Key for caching in
|
||||
*/
|
||||
abstract protected function fetchField($data, $params = array(), $field, $cache_key = null);
|
||||
|
||||
/**
|
||||
* @param string $data Request
|
||||
* @param array $params Request parameters
|
||||
* @param CacheKey $cache_key Key for caching in
|
||||
* @param \CacheKey $cache_key Key for caching in
|
||||
*/
|
||||
abstract protected function fetch($data, $params = array(), $cache_key = null);
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @param CacheKey $cache_key
|
||||
* @param \CacheKey $cache_key
|
||||
*/
|
||||
abstract protected function fetchAll($data, $params = array(), $cache_key = null);
|
||||
}
|
Reference in New Issue
Block a user