Example #1
0
 /**
  * @param string $site
  */
 private static function _createContext($site)
 {
     $ctx = new MShop_Context_Item_Default();
     $arcavias = self::_getArcavias();
     $paths = $arcavias->getConfigPaths('mysql');
     $paths[] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config';
     $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
     $conf = new MW_Config_Array(array(), $paths);
     $conf = new MW_Config_Decorator_Memory($conf);
     $conf = new MW_Config_Decorator_Documentor($conf, $file);
     $ctx->setConfig($conf);
     $dbm = new MW_DB_Manager_PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $logger = new MW_Logger_File($site . '.log', MW_Logger_Abstract::DEBUG);
     $ctx->setLogger($logger);
     $cache = new MW_Cache_None();
     $ctx->setCache($cache);
     $i18n = new MW_Translation_None('de');
     $ctx->setI18n(array('de' => $i18n));
     $session = new MW_Session_None();
     $ctx->setSession($session);
     $localeManager = MShop_Locale_Manager_Factory::createManager($ctx);
     $locale = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($locale);
     $ctx->setEditor('core:client/html');
     return $ctx;
 }
Example #2
0
 /**
  * Returns the current context
  *
  * @param boolean $locale True to add locale object to context, false if not
  * @return \MShop_Context_Item_Interface Context object
  */
 public function get($locale = true)
 {
     if (self::$context === null) {
         $context = new \MShop_Context_Item_Default();
         $config = $this->getConfig();
         $context->setConfig($config);
         $dbm = new \MW_DB_Manager_PDO($config);
         $context->setDatabaseManager($dbm);
         $mail = new \MW_Mail_Swift(function () {
             return app('mailer')->getSwiftMailer();
         });
         $context->setMail($mail);
         $logger = \MAdmin_Log_Manager_Factory::createManager($context);
         $context->setLogger($logger);
         $cache = new \MAdmin_Cache_Proxy_Default($context);
         $context->setCache($cache);
         self::$context = $context;
     }
     $context = self::$context;
     if ($locale === true) {
         $localeItem = $this->getLocale($context);
         $langid = $localeItem->getLanguageId();
         $context->setLocale($localeItem);
         $context->setI18n(app('\\Aimeos\\Shop\\Base\\I18n')->get(array($langid)));
     }
     $session = new \MW_Session_Laravel4($this->session);
     $context->setSession($session);
     $this->addUser($context);
     return $context;
 }
Example #3
0
 /**
  * Returns the current context.
  *
  * @param \TYPO3\Flow\Mvc\RequestInterface $request Request object
  * @return \MShop_Context_Item_Interface
  */
 public function get(\TYPO3\Flow\Mvc\RequestInterface $request = null)
 {
     if (self::$context === null) {
         $context = new \MShop_Context_Item_Default();
         $config = $this->getConfig();
         $context->setConfig($config);
         $dbm = new \MW_DB_Manager_PDO($config);
         $context->setDatabaseManager($dbm);
         $mail = new \MW_Mail_Swift($this->mailer);
         $context->setMail($mail);
         $logger = \MAdmin_Log_Manager_Factory::createManager($context);
         $context->setLogger($logger);
         $cache = $this->getCache($context);
         $context->setCache($cache);
         self::$context = $context;
     }
     $context = self::$context;
     if ($request !== null) {
         $localeItem = $this->getLocale($context, $request);
         $context->setLocale($localeItem);
         $i18n = $this->i18n->get(array($localeItem->getLanguageId()));
         $context->setI18n($i18n);
     }
     $session = new \MW_Session_Flow($this->session);
     $context->setSession($session);
     $this->addUser($context);
     return $context;
 }
Example #4
0
 /**
  * Returns a bare context object
  *
  * @return \MShop_Context_Item_Default Context object containing only the most necessary dependencies
  */
 protected function getBareContext()
 {
     $ctx = new \MShop_Context_Item_Default();
     $conf = new \MW_Config_Array(array(), array());
     $ctx->setConfig($conf);
     $locale = \MShop_Factory::createManager($ctx, 'locale')->createItem();
     $locale->setLanguageId('en');
     $ctx->setLocale($locale);
     $i18n = new \MW_Translation_Zend2(array(), 'gettext', 'en', array('disableNotices' => true));
     $ctx->setI18n(array('en' => $i18n));
     return $ctx;
 }
Example #5
0
 /**
  * @param string $site
  */
 private static function _createContext($site)
 {
     $ctx = new MShop_Context_Item_Default();
     $aimeos = self::_getAimeos();
     $paths = $aimeos->getConfigPaths('mysql');
     $paths[] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config';
     $conf = new MW_Config_Array(array(), $paths);
     $ctx->setConfig($conf);
     $dbm = new MW_DB_Manager_PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $logger = new MW_Logger_File($site . '.log', MW_Logger_Abstract::DEBUG);
     $ctx->setLogger($logger);
     $i18n = new MW_Translation_None('de');
     $ctx->setI18n(array('de' => $i18n));
     $session = new MW_Session_None();
     $ctx->setSession($session);
     $localeManager = MShop_Locale_Manager_Factory::createManager($ctx);
     $localeItem = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($localeItem);
     $ctx->setEditor('ai-swiftmailer:lib/custom');
     return $ctx;
 }
Example #6
0
 /**
  * Creates a new context item.
  *
  * @param string $site Unique site code
  * @return \MShop_Context_Item_Interface Context object
  */
 private static function _createContext($site)
 {
     $ctx = new MShop_Context_Item_Default();
     $mshop = self::_getAimeos();
     $paths = $mshop->getConfigPaths('mysql');
     $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
     $conf = new MW_Config_Array(array(), $paths);
     $ctx->setConfig($conf);
     $dbm = new MW_DB_Manager_PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $logger = new MW_Logger_File($site . '.log', MW_Logger_Abstract::DEBUG);
     $ctx->setLogger($logger);
     $session = new MW_Session_None();
     $ctx->setSession($session);
     $localeManager = MShop_Locale_Manager_Factory::createManager($ctx);
     $localeItem = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($localeItem);
     $ctx->setEditor('ai-symfony:unittest');
     return $ctx;
 }
Example #7
0
 private static function _createContext($site)
 {
     $ctx = new MShop_Context_Item_Default();
     $arcavias = self::_getArcavias();
     $paths = $arcavias->getConfigPaths('mysql');
     $paths[] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config';
     $conf = new MW_Config_Array(array(), $paths);
     $conf = new MW_Config_Decorator_Memory($conf);
     $ctx->setConfig($conf);
     $dbm = new MW_DB_Manager_PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $logger = new MW_Logger_File($site . '.log', MW_Logger_Abstract::DEBUG);
     $ctx->setLogger($logger);
     $session = new MW_Session_None();
     $ctx->setSession($session);
     $localeManager = MShop_Locale_Manager_Factory::createManager($ctx);
     $locale = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($locale);
     $ctx->setEditor('<extname>:controller/frontend');
     return $ctx;
 }
Example #8
0
 /**
  * Returns a new context object.
  *
  * @return MShop_Context_Item_Interface Context object
  */
 protected static function getContext()
 {
     $ctx = new \MShop_Context_Item_Default();
     $conf = \Aimeos\Aimeos\Base::getConfig();
     $ctx->setConfig($conf);
     $dbm = new \MW_DB_Manager_PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $logger = new \MW_Logger_Errorlog(\MW_Logger_ABSTRACT::INFO);
     $ctx->setLogger($logger);
     $session = new \MW_Session_None();
     $ctx->setSession($session);
     $cache = new \MW_Cache_None();
     $ctx->setCache($cache);
     return $ctx;
 }
Example #9
0
     }
 }
 $site = 'default';
 if (count($params) > 0 && ($site = end($params)) === false) {
     usage();
 }
 spl_autoload_register('setup_autoload');
 require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
 $arcavias = new Arcavias(isset($options['extdir']) ? (array) $options['extdir'] : array());
 $taskPaths = $arcavias->getSetupPaths($site);
 $includePaths = $taskPaths;
 $includePaths[] = get_include_path();
 if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) {
     throw new Exception('Unable to extend include path');
 }
 $ctx = new MShop_Context_Item_Default();
 $confPaths = $arcavias->getConfigPaths('mysql');
 if (isset($options['config'])) {
     $confPaths = array_merge($confPaths, (array) $options['config']);
 }
 $conf = new MW_Config_Array(array(), $confPaths);
 $conf = new MW_Config_Decorator_Memory($conf);
 $ctx->setConfig($conf);
 $conf->set('setup/site', $site);
 if (isset($options['option'])) {
     foreach ((array) $options['option'] as $option) {
         $parts = explode(':', $option);
         if (count($parts) !== 2) {
             printf("Invalid config option \"%1\$s\"\n", $option);
             usage();
         }