示例#1
0
 /**
  * Constructs a new model manager
  * @return null
  */
 private function __construct()
 {
     $this->models = array();
     $objectFactory = new ObjectFactory();
     $modelIO = $objectFactory->createFromConfig(self::CONFIG_MODEL_IO, self::DEFAULT_MODEL_IO, self::INTERFACE_MODEL_IO);
     $modelReader = new ModelReader($modelIO);
     $this->modelLoader = new ModelLoader($modelReader);
     $this->modelCache = $objectFactory->createFromConfig(self::CONFIG_MODEL_CACHE, self::DEFAULT_MODEL_CACHE, self::INTERFACE_MODEL_CACHE);
 }
示例#2
0
 /**
  * Constructs a new translation manager
  * @return null
  *
  * @uses zibo\library\ObjectFactory::createFromConfig()
  */
 public function __construct()
 {
     $objectFactory = new ObjectFactory();
     $this->io = $objectFactory->createFromConfig(self::CONFIG_IO, self::CLASS_IO, self::INTERFACE_IO);
     $this->translators = array();
 }
示例#3
0
 /**
  * Deliver this message to the mail transport
  * @param array $variables Variables for the mail
  * @param zibo\library\mail\transport\Mail $transport The transport implementation to use, if not provided, the transport will be provided throught the Zibo configuration
  * @return null
  */
 public function send(array $variables = array(), Transport $transport = null)
 {
     if ($transport === null) {
         $objectFactory = new ObjectFactory();
         $transport = $objectFactory->createFromConfig(self::CONFIG_TRANSPORT, self::DEFAULT_TRANSPORT, self::INTERFACE_TRANSPORT);
     }
     $transport->send($this, $variables);
 }
 /**
  * Action to create a diagram of the models
  * @return null
  */
 public function erdAction()
 {
     if (!class_exists(self::CLASS_ERD) || func_num_args()) {
         $this->setError404();
         return;
     }
     ini_set('max_execution_time', '300');
     ini_set('memory_limit', '512M');
     $models = ModelManager::getInstance()->getModels(true);
     $objectFactory = new ObjectFactory();
     $layout = $objectFactory->createFromConfig(self::CONFIG_ERD_LAYOUT, self::DEFAULT_ERD_LAYOUT, self::INTERFACE_ERD_LAYOUT);
     $erd = new Erd();
     $erd->setLayout($layout);
     $file = $erd->getFile($models);
     $this->setDownloadView($file);
 }
示例#5
0
 /**
  * Gets the negotiator implementation to use for locale negotiation.
  *
  * You can configure which class is being used with the configuration key "i18n.negotiator".
  *
  * @return zibo\library\i18n\locale\negotiator\Negotiator
  */
 private function getNegotiator()
 {
     if (!$this->negotiator) {
         $objectFactory = new ObjectFactory();
         $this->negotiator = $objectFactory->createFromConfig(self::CONFIG_NEGOTIATOR, self::CLASS_NEGOTIATOR, self::INTERFACE_NEGOTIATOR);
     }
     return $this->negotiator;
 }
示例#6
0
 /**
  * Get the route I/O implementation. When no implementation is provided through the constructor,
  * a new implementation will be constructed based on the configuration.
  * @return zibo\core\router\io\RouterIO
  */
 protected final function getIO()
 {
     if ($this->io) {
         return $this->io;
     }
     $objectFactory = new ObjectFactory();
     $this->io = $objectFactory->createFromConfig(self::CONFIG_ROUTER_IO, self::DEFAULT_ROUTER_IO, self::CLASS_ROUTER_IO);
     return $this->io;
 }