Exemplo n.º 1
0
 /**
  * Get the application instance
  *
  * @return Zym_App
  */
 public static function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemplo n.º 2
0
/**
 * Zym Engine
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @copyright  Copyright (c) 2008 Zym. (http://www.zym-project.com/)
 * @license http://www.zym-project.com/license New BSD License
 */
/**
 * Project Path
 *
 */
define('PATH_PROJECT', dirname(dirname(__FILE__)) . '/');
/**
 * Include paths
 */
include_once PATH_PROJECT . 'config/paths.php';
/**
 * @see Zym_App
 */
require_once 'Zym/App.php';
/**
 * @see Zend_Controller_Front
 */
require_once 'Zend/Controller/Front.php';
Zym_App::run(PATH_PROJECT . 'config/bootstrap.xml', Zym_App::ENV_PRODUCTION);
Zend_Controller_Front::getInstance()->dispatch();
Exemplo n.º 3
0
 public function testSetConfigFromZendConfig()
 {
     $app = Zym_App::getInstance();
     $app->setConfig(new Zend_Config(array('test' => 'test')));
     $this->assertEquals('test', $app->getConfig()->get('test'));
 }
Exemplo n.º 4
0
<?php

$app = Zym_App::getInstance();
$app->setEnvironment(Zym_App::ENV_PRODUCTION);
$app->setConfig('../bootstrap.ini');
// Dispatch
$app->dispatch();
Exemplo n.º 5
0
 /**
  * Construct
  *
  * @return void
  */
 public function __construct(Zym_App $app, Zend_Config $config = null, $environment = null)
 {
     $dispatcher = $app->getMessageDispatcher();
     $dispatcher->post('beforeResourceLoaded', $this);
     // Set app
     $this->setApp($app);
     // Cache
     $this->setCache($app->getCache());
     // Set config
     if ($config) {
         if ($environment === null) {
             $environment = $this->getEnvironment();
         }
         $this->setConfig($config, $environment);
     }
     // Extension api
     $this->init($this->getConfig());
     // Setup listener to dispatch resource
     if (isset($this->_dispatchEvent)) {
         $event = is_array($this->_dispatchEvent) && isset($this->_dispatchEvent[0]) ? $this->_dispatchEvent[0] : $this->_dispatchEvent;
         $callback = is_array($this->_dispatchEvent) && isset($this->_dispatchEvent[1]) ? $this->_dispatchEvent[1] : 'dispatch';
         $dispatcher->attach($this, $event, $callback);
     }
     $dispatcher->post('afterResourceLoaded', $this);
 }