Пример #1
0
 /**
  * Creates the type manager using the given context object.
  *
  * @param MShop_Context_Item_Interface $context Context object with required objects
  *
  * @throws MShop_Exception if no configuration is available
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     $conf = $context->getConfig();
     $confpath = $this->_getConfigPath();
     $this->_config = array('insert' => $conf->get($confpath . 'insert'), 'update' => $conf->get($confpath . 'update'), 'delete' => $conf->get($confpath . 'delete'), 'search' => $conf->get($confpath . 'search'), 'count' => $conf->get($confpath . 'count'), 'newid' => $conf->get($confpath . 'newid'));
     $this->_searchConfig = $this->_getSearchConfig();
     $required = array('count', 'delete', 'insert', 'newid', 'search', 'update');
     $isList = array_keys($this->_config);
     foreach ($required as $key) {
         if (!in_array($key, $isList)) {
             throw new MShop_Exception(sprintf('Configuration of necessary SQL statement for "%1$s" not available', $key));
         }
     }
     parent::__construct($context);
     $this->_context = $context;
     if (($entry = reset($this->_searchConfig)) === false) {
         throw new MShop_Exception(sprintf('Search configuration not available'));
     }
     if (($pos = strrpos($entry['code'], '.')) == false) {
         throw new MShop_Exception(sprintf('Search configuration for "%1$s" not available', $entry['code']));
     }
     if (($this->_prefix = substr($entry['code'], 0, $pos + 1)) === false) {
         throw new MShop_Exception(sprintf('Search configuration for "%1$s" not available', $entry['code']));
     }
 }
Пример #2
0
 /**
  * Creates the manager that will use the given context object.
  *
  * @param MShop_Context_Item_Interface $context Context object with required objects
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     parent::__construct($context);
     $this->_setResourceName('db-order');
     $sites = $context->getLocale()->getSiteSubTree();
     $this->_replaceSiteMarker($this->_searchConfig['order.containsStatus'], 'mordst_cs."siteid"', $sites, ':site');
 }
Пример #3
0
 /**
  * Initializes the manager instance.
  *
  * @param MShop_Context_Item_Interface $context Context object
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     parent::__construct($context);
     $this->_setResourceName('db-product');
     $site = $context->getLocale()->getSitePath();
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.attribute.code'], 'mcatinat."siteid"', $site);
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.attributecount'], 'mcatinat2."siteid"', $site);
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.attributeaggregate'], 'mcatinat2."siteid"', $site);
 }
Пример #4
0
 /**
  * Initializes the manager instance.
  *
  * @param MShop_Context_Item_Interface $context Context object
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     parent::__construct($context);
     $this->_setResourceName('db-product');
     $site = $context->getLocale()->getSitePath();
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.text.value'], 'mcatinte."siteid"', $site);
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.text.relevance'], 'mcatinte2."siteid"', $site);
     $this->_replaceSiteMarker($this->_searchConfig['sort:catalog.index.text.relevance'], 'mcatinte2."siteid"', $site);
 }
Пример #5
0
 /**
  * Initializes the manager instance.
  *
  * @param MShop_Context_Item_Interface $context Context object
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     parent::__construct($context);
     $this->_setResourceName('db-product');
     $site = $context->getLocale()->getSitePath();
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.price.quantity'], 'mcatinpr."siteid"', $site);
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.price.value'], 'mcatinpr."siteid"', $site);
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.price.costs'], 'mcatinpr."siteid"', $site);
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.price.rebate'], 'mcatinpr."siteid"', $site);
     $this->_replaceSiteMarker($this->_searchConfig['catalog.index.price.taxrate'], 'mcatinpr."siteid"', $site);
 }
Пример #6
0
 /**
  * Creates the common list manager using the given context object.
  *
  * @param MShop_Context_Item_Interface $context Context object with required objects
  *
  * @throws MShop_Exception if no configuration is available
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     $this->_configPath = $this->_getConfigPath();
     $this->_searchConfig = $this->_getSearchConfig();
     if (($entry = reset($this->_searchConfig)) === false) {
         throw new MShop_Exception(sprintf('Search configuration not available'));
     }
     if (($pos = strrpos($entry['code'], '.')) == false) {
         throw new MShop_Exception(sprintf('Search configuration for "%1$s" not available', $entry['code']));
     }
     if (($this->_prefix = substr($entry['code'], 0, $pos + 1)) === false) {
         throw new MShop_Exception(sprintf('Search configuration for "%1$s" not available', $entry['code']));
     }
     parent::__construct($context);
 }
Пример #7
0
 /**
  * Initializes the object.
  *
  * @param MShop_Context_Item_Interface $context Context object
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     parent::__construct($context);
     $this->_setResourceName('db-order');
 }
Пример #8
0
 /**
  * Initializes the manager decorator.
  *
  * @param MShop_Context_Item_Interface $context Context object with required objects
  * @param MShop_Common_Manager_Interface $manager Manager object
  */
 public function __construct(MShop_Context_Item_Interface $context, MShop_Common_Manager_Interface $manager)
 {
     parent::__construct($context);
     $this->_manager = $manager;
 }