/** * Model 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() . DIRECTORY_SEPARATOR; } else { $options['directory'] .= DIRECTORY_SEPARATOR; } if (empty($options['namespace']) || $options['namespace'] != 'None') { if (empty($options['module'])) { $options['namespace'] = Tools::getBaseNamespace() . Tools::getModelsDir(); } else { $options['namespace'] = Tools::getBaseNamespace() . $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; }
/** * 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; }