Пример #1
0
 /**
  * @todo Retornar a conexão de acordo com o setado no modelo
  */
 public static function getStorage()
 {
     $oStore = new \Faderim\DataBase\RelationalStorage();
     $oStore->setModelInfo(self::getModelInfo());
     $oStore->setConnection(\Faderim\Core\Engine::getInstance()->getConnection(false));
     return $oStore;
 }
Пример #2
0
 protected function parseXpath(\Faderim\Reader\XPath $xPath)
 {
     $sCnxName = $xPath->queryFirstValue('//connection/@name');
     $sType = $xPath->queryFirstValue('//connection/type');
     $sHost = $xPath->queryFirstValue('//connection/host');
     $sPort = $xPath->queryFirstValue('//connection/port');
     $sUser = $xPath->queryFirstValue('//connection/user');
     $sPass = $xPath->queryFirstValue('//connection/password');
     $sData = $xPath->queryFirstValue('//connection/database');
     $bDefault = $xPath->queryFirstValue('//connection/default');
     $oCnx = \Faderim\DataBase\BaseConnection::factory($sType, $sHost, $sPort, $sUser, $sPass, $sData);
     \Faderim\Core\Engine::getInstance()->addConnection($sCnxName, $oCnx, $bDefault);
 }
Пример #3
0
 public function __construct()
 {
     $pageName = (string) isset($_GET['p']) ? $_GET['p'] : 'index';
     $actionName = (string) isset($_GET['a']) ? $_GET['a'] : 'default';
     $processName = (string) isset($_GET['pr']) ? $_GET['pr'] : null;
     $ActionPage = new \Faderim\Framework\Model\ActionPage();
     $ActionPage->getPage()->setName($pageName);
     $ActionPage->getAction()->setName($actionName);
     //$ActionPage->setProcess($processName);
     if ($ActionPage->storage()->get()) {
         $sCtrlName = $ActionPage->getControllerName();
         if (!\Faderim\Core\Engine::getInstance()->getLoader()->classExists($sCtrlName)) {
             $sCtrlName = $ActionPage->getControllerDefaultForAction();
         }
         $oController = new $sCtrlName($ActionPage);
         if ($processName) {
             $oController->{$processName}();
         }
         $oController->render();
     } else {
         throw new \Exception('No action Page found!');
     }
 }