Horde_Kolab_Storage_Factory::create PHP Method

create() public method

Create the storage handler.
public create ( ) : Horde_Kolab_Storage
return Horde_Kolab_Storage The storage handler.
    public function create()
    {
        if (isset($this->_params['storage'])) {
            $sparams = $this->_params['storage'];
        } else {
            $sparams = array();
        }
        if (isset($this->_params['queries'])) {
            $sparams['queries'] = $this->_params['queries'];
        }
        if (isset($this->_params['queryset'])) {
            $queryset = $this->_params['queryset'];
            $sparams['queryset'] = $this->_params['queryset'];
        } else {
            $queryset = array();
        }
        $cache = $this->createCache();
        if (!empty($this->_params['cache'])) {
            $storage = new Horde_Kolab_Storage_Cached($this->createDriver(), new Horde_Kolab_Storage_QuerySet_Cached($this, $queryset, $cache), $this, $cache, $this->_params['logger'], $sparams);
        } else {
            $storage = new Horde_Kolab_Storage_Uncached($this->createDriver(), new Horde_Kolab_Storage_QuerySet_Uncached($this, $queryset), $this, $cache, $this->_params['logger'], $sparams);
        }
        if (empty($this->_params['sync_strategy'])) {
            $strategy = new Horde_Kolab_Storage_Synchronization_OncePerSession();
        } else {
            $strategy = $this->_params['sync_strategy'];
        }
        $storage = new Horde_Kolab_Storage_Decorator_Synchronization($storage, new Horde_Kolab_Storage_Synchronization($strategy));
        return $storage;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Return the Horde_Kolab_Storage:: instance.
  *
  * @return Horde_Kolab_Storage The storage handler.
  */
 public function create()
 {
     $configuration = $this->_injector->getInstance('Horde_Kolab_Storage_Configuration');
     $params = array('driver' => 'horde', 'params' => array('host' => $configuration['server'], 'username' => $GLOBALS['registry']->getAuth(), 'password' => $GLOBALS['registry']->getAuthCredential('password'), 'port' => $configuration['port'], 'secure' => $configuration['secure']), 'queries' => array('list' => array(Horde_Kolab_Storage_List_Tools::QUERY_BASE => array('cache' => true), Horde_Kolab_Storage_List_Tools::QUERY_ACL => array('cache' => true), Horde_Kolab_Storage_List_Tools::QUERY_SHARE => array('cache' => true))), 'queryset' => array('data' => array('queryset' => 'horde')), 'logger' => $this->_injector->getInstance('Horde_Log_Logger'), 'log' => array('debug'), 'cache' => $this->_injector->getInstance('Horde_Cache'));
     $factory = new Horde_Kolab_Storage_Factory($params);
     return $factory->create();
 }
All Usage Examples Of Horde_Kolab_Storage_Factory::create