Пример #1
0
 /**
  * AllModels Construct
  *
  * @param $options
  * @throws \Exception
  */
 public function __construct($options)
 {
     if (empty($options['name'])) {
         $options['name'] = Text::camelize($options['tableName']);
     }
     if (empty($options['directory'])) {
         $options['directory'] = Tools::getModulesPath() . $options['module'] . DIRECTORY_SEPARATOR . Tools::getModelsDir();
     }
     if (empty($options['namespace']) || $options['namespace'] != 'None') {
         if (empty($options['module'])) {
             $options['namespace'] = Tools::getBaseModule() . Tools::getModelsDir();
         } else {
             $options['namespace'] = Tools::getBaseModule() . $options['module'] . '\\' . Tools::getModelsDir();
         }
     }
     if (empty($options['baseClass'])) {
         $options['baseClass'] = 'Phalcon\\Mvc\\Model';
     }
     if (empty($options['tableName'])) {
         throw new \Exception("Please, specify the table name");
     }
     if (!isset($options['force'])) {
         $options['force'] = false;
     }
     $this->_options = $options;
 }
Пример #2
0
 /**
  * Controller constructor
  *
  * @param array $options
  * @throws \Exception
  */
 public function __construct($options)
 {
     if (empty($options['name'])) {
         throw new \Exception("Please specify the controller name");
     }
     if (empty($options['force'])) {
         $options['force'] = false;
     }
     if (empty($options['directory'])) {
         $options['directory'] = Tools::getModulesPath() . $options['module'] . DIRECTORY_SEPARATOR . Tools::getControllersDir() . DIRECTORY_SEPARATOR;
     } else {
         $options['directory'] .= DIRECTORY_SEPARATOR;
     }
     if (empty($options['namespace']) || $options['namespace'] != 'None') {
         if (empty($options['module'])) {
             $options['namespace'] = Tools::getBaseModule() . Tools::getControllersDir();
         } else {
             $options['namespace'] = Tools::getBaseModule() . $options['module'] . '\\' . Tools::getControllersDir();
         }
     }
     if (empty($options['baseClass'])) {
         $options['baseClass'] = 'Phalcon\\Mvc\\Controller';
     }
     $this->_options = $options;
 }
 /**
  * @throws \Exception
  */
 public function indexAction()
 {
     $selectedModule = null;
     $params = $this->router->getParams();
     if (!empty($params)) {
         $selectedModule = $this->router->getParams()[0];
     }
     $this->view->selectedModule = $selectedModule;
     $this->view->directoryPath = Tools::getModulesPath() . $selectedModule . Tools::getControllersDir();
 }
Пример #4
0
 /**
  * View Construct
  * @param $options
  * @throws \Exception
  */
 public function __construct($options)
 {
     if (empty($options['name'])) {
         throw new \Exception("Please specify the view name");
     }
     if (!isset($options['force'])) {
         $options['force'] = false;
     }
     if (!isset($options['directory'])) {
         $options['directory'] = Tools::getModulesPath() . $options['module'] . DIRECTORY_SEPARATOR . Tools::getViewsDir() . DIRECTORY_SEPARATOR;
     } else {
         $options['directory'] .= DIRECTORY_SEPARATOR;
     }
     if (!isset($options['action'])) {
         $options['action'] = 'index';
     }
     $this->_options = $options;
 }
Пример #5
0
 /**
  * Controller constructor
  *
  * @param array $options
  * @throws \Exception
  */
 public function __construct($options)
 {
     if (empty($options['name'])) {
         throw new \Exception("Please specify the module name");
     }
     if (empty($options['directory'])) {
         $options['directory'] = Tools::getModulesPath() . $options['name'] . DIRECTORY_SEPARATOR;
     } else {
         $options['directory'] .= DIRECTORY_SEPARATOR;
     }
     if (empty($options['namespace']) || $options['namespace'] != 'None') {
         $options['namespace'] = Tools::getBaseNamespace() . $options['name'];
     }
     if (empty($options['routes'])) {
         $options['routes'] = false;
     }
     if (empty($options['force'])) {
         $options['force'] = false;
     }
     $this->_options = $options;
 }