/** * Generate a constructor */ private function _generateGetServiceConfig($className, $tables) { $this->_data .= "\t/**\n"; $this->_data .= "\t* getServiceConfig\n"; $this->_data .= "\t*\n"; $this->_data .= "\t**/\n"; $this->_data .= "\tpublic function getServiceConfig()\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\treturn array(\n"; $this->_data .= "\t\t\t'shared' => array(\n"; $this->_data .= "\t\t\t),\n"; $this->_data .= "\t\t\t'factories' => array(\n"; // First add mappers $this->_data .= "\t\t\t\t// Adding all mappers for namespace\n"; foreach ($tables as $table => $data) { $this->_data .= "\t\t\t\t'" . ZendModelCreator::getNamespace() . "\\Mapper\\" . ZendModelCreator::toCamelCase(ucfirst(strtolower($table))) . "Mapper' => function(\$sm) {\n"; $this->_data .= "\t\t\t\t\t\$mapper = new Mapper\\" . ZendModelCreator::toCamelCase(ucfirst(strtolower($table))) . "Mapper;\n"; $this->_data .= "\t\t\t\t\t\$mapper->setDbAdapter(\$sm->get('" . strtolower(ZendModelCreator::getNamespace()) . "_zend_db_adapter'));\n"; $this->_data .= "\t\t\t\t\treturn \$mapper;\n"; $this->_data .= "\t\t\t\t},\n"; } $this->_data .= "\n"; $this->_data .= "\t\t\t\t// Adding all services for namespace\n"; // Then add Services foreach ($tables as $table => $data) { $this->_data .= "\t\t\t\t'" . ZendModelCreator::getNamespace() . "\\Service\\" . ZendModelCreator::toCamelCase(ucfirst(strtolower($table))) . "' => function(\$sm) {\n"; $this->_data .= "\t\t\t\t\t\$service = new Service\\" . ZendModelCreator::toCamelCase(ucfirst(strtolower($table))) . ";\n"; $this->_data .= "\t\t\t\t\t\$service->setMapper(\$sm->get('" . ZendModelCreator::getNamespace() . "\\Mapper\\" . ZendModelCreator::toCamelCase(ucfirst(strtolower($table))) . "Mapper'));\n"; $this->_data .= "\t\t\t\t\t\$service->setOptions(\$sm->get('" . ZendModelCreator::getNamespace() . "\\Options\\ModuleOptions'));\n"; $this->_data .= "\t\t\t\t\treturn \$service;\n"; $this->_data .= "\t\t\t\t},\n"; } // Add module options $this->_data .= "\n"; $this->_data .= "\t\t\t\t// Adding module options\n"; $this->_data .= "\t\t\t\t'" . ZendModelCreator::getNamespace() . "\\Options\\ModuleOptions' => function(\$sm) {\n"; $this->_data .= "\t\t\t\t\t\$config = \$sm->get('Configuration');\n"; $this->_data .= "\t\t\t\t\t\$moduleConfig = isset(\$config['" . strtolower(ZendModelCreator::getNamespace()) . "']) ? \$config['" . strtolower(ZendModelCreator::getNamespace()) . "'] : array();\n"; $this->_data .= "\t\t\t\t\treturn new Options\\ModuleOptions(\$moduleConfig);\n"; $this->_data .= "\t\t\t\t},\n"; $this->_data .= "\t\t\t),\n"; $this->_data .= "\t\t);\n"; $this->_data .= "\t}\n\n"; }
private function _generateClassHeader($className) { $this->_data .= "<?php\n/**\n* {$className} Data Transfer Object\n*\n* @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n* @licence GNU/GPL V 2.0\n* @contact " . ZendModelCreator::getContact() . "\n* @since " . date("Y-m-d") . "\n*\n**/\n\nrequire_once('db/GenericDTO.php');\n\nclass {$className} extends GenericDTO\n{\n\n"; }
public function setDirectoryStructure($directoryStructure) { self::$directoryStructure = $directoryStructure; }
private function _generateClassHeader($className) { $className = strtolower($className); $this->_data .= "<?php\n/**\n * {$className} Service API\n * \n * @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n * @licence GNU/GPL V 1.0\n * @contact " . ZendModelCreator::getContact() . "\n * @since " . date("Y-m-d") . "\n *\n */\n\ninterface I" . ucfirst($className) . "Service {\n\n"; }
private function _generateClassHeader($className) { $className = strtolower($className); $this->_data .= "<?php\n/**\n * Entity mapping class for {$className}\n * \n * @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n * @licence GNU/GPL V 1.0\n * @contact " . ZendModelCreator::getContact() . "\n * @since " . date("Y-m-d") . "\n *\n */\n\nrequire_once('db/GenericEntity.php');\n\nclass " . ucfirst(strtolower($className)) . "Entity extends GenericEntity {\n\n"; }
/** * Generates header for Options class * */ private function _generateClassHeader($className) { $this->_data .= "<?php\n/**\n* file: ModuleOptions.php\n* Module options\n*\n* @author " . ZendModelCreator::getGenerator() . "\n* @version " . ZendModelCreator::getVersion() . "\n* @package " . ZendModelCreator::getNamespace() . "\n* @package " . ZendModelCreator::getNamespace() . "\n* @since " . date("Y-m-d") . "\n*/\n\nnamespace " . ZendModelCreator::getNamespace() . "\\Options;\n\nuse Zend\\Stdlib\\AbstractOptions;\n\n/**\n* Module\n*\n* @author " . ZendModelCreator::getGenerator() . "\n* @version " . ZendModelCreator::getVersion() . "\n* @package " . ZendModelCreator::getNamespace() . "\n* @since " . date("Y-m-d") . "\n*\n**/\nclass ModuleOptions extends AbstractOptions\n{\n protected \$__strictMode__ = false;\n protected \$hydrateResultsByDefault = true;\n"; }
private function _generateClassHeader($className) { $className = $className; $folderName = strtolower($className); $this->_data .= "<?php\n/**\n * Data access object for {$className}\n *\n * @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n * @licence GNU/GPL V 1.0\n * @contact " . ZendModelCreator::getContact() . "\n * @since " . date("Y-m-d") . "\n *\n */\n\nrequire_once('{$folderName}/" . ZendModelCreator::$directoryStructure['DirectoryStructure']['DTO'] . "/" . str_replace("[tbl]", $className, ZendModelCreator::$directoryStructure['FileNames']['DTO']) . "');\nrequire_once('{$folderName}/" . ZendModelCreator::$directoryStructure['DirectoryStructure']['ENT'] . "/" . str_replace("[tbl]", $className, ZendModelCreator::$directoryStructure['FileNames']['ENT']) . "');\nrequire_once('db/GenericDAO.php');\nrequire_once('db/GenericDateTime.php');\n\nclass " . $className . "DAO extends GenericDAO {\n\n"; }
private function _generateClassHeader($className) { $className = strtolower($className); $this->_data .= "<?php\n/**\n* " . ucfirst($className) . "ServiceException extends Exception\n* \n* @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n* @licence GNU/GPL V 2.0\n* @contact " . ZendModelCreator::getContact() . "\n* @since " . date("Y-m-d") . "\n*\n**/\n\nclass " . substr(str_replace('[tbl]', ucfirst($className), ZendModelCreator::$directoryStructure['FileNames']['EXC']), 0, -4) . " extends Exception\n{\n\n\t/** \n\t * Constructor\n\t * @param string error message\n\t * @param int error code\n\t * @return void\n\t * @access public\n\t */\n"; }
private function _generateClassHeader($className) { $className = strtolower($className); $folderName = strtolower($className); $this->_data .= "<?php\n/**\n *Implementation of {$className} Service\n *\n * @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n * @licence GNU/GPL V 1.0\n * @contact " . ZendModelCreator::getContact() . "\n * @since " . date("Y-m-d") . "\n *\n */\n\nrequire_once('{$folderName}/" . ZendModelCreator::$directoryStructure['DirectoryStructure']['DTO'] . "/" . str_replace("[tbl]", ucfirst(strtolower($className)), ZendModelCreator::$directoryStructure['FileNames']['INT']) . "');\nrequire_once('{$folderName}/" . ZendModelCreator::$directoryStructure['DirectoryStructure']['DAO'] . "/" . str_replace("[tbl]", ucfirst(strtolower($className)), ZendModelCreator::$directoryStructure['FileNames']['DAO']) . "');\nrequire_once('{$folderName}/" . ZendModelCreator::$directoryStructure['DirectoryStructure']['EXC'] . "/" . str_replace("[tbl]", ucfirst(strtolower($className)), ZendModelCreator::$directoryStructure['FileNames']['EXC']) . "');\nrequire_once('" . ZendModelCreator::$directoryStructure['DirectoryStructure']['CON'] . "/ErrorConstants.php');\n\nclass " . ucfirst(strtolower($className)) . "Service implements I" . ucfirst(strtolower($className)) . "Service {\n\n"; }
private function _generateClassHeader($className) { $className = strtolower($className); $this->_data .= "<?php\n/**\n* " . ucfirst($className) . " Service API\n* \n* @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n* @licence GNU/GPL V 2.0\n* @contact " . ZendModelCreator::getContact() . "\n* @since " . date("Y-m-d") . "\n*\n**/\n\ninterface " . substr(str_replace('[tbl]', ucfirst($className), ZendModelCreator::$directoryStructure['FileNames']['INT']), 0, -4) . "\n{\n\n"; }
/** * Generates setEventManager * */ private function _generateSetEventManager($className) { // Set fetch function headers $this->_data .= "\t/**\n"; $this->_data .= "\t* Set the Event Manager\n"; $this->_data .= "\t*\n"; $this->_data .= "\t* @param object Zend\\EventManager\\EventManagerInterface\n"; $this->_data .= "\t* @return object \$this\n"; $this->_data .= "\t**/\n"; $this->_data .= "\tpublic function setEventManager(EventManagerInterface \$eventManager)\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\t\$eventManager->setIdentifiers(\n"; $this->_data .= "\t\t\t__CLASS__,\n"; $this->_data .= "\t\t\tget_called_class(),\n"; $this->_data .= "\t\t\t'" . strtolower($className) . "'\n"; $this->_data .= "\t\t);\n"; $this->_data .= "\n"; $this->_data .= "\t\t\$eventManager->setEventClass('" . ZendModelCreator::getNamespace() . "\\Service\\" . ucfirst(strtolower($className)) . "Event');\n"; $this->_data .= "\n"; $this->_data .= "\t\t\$this->eventManager = \$eventManager;\n"; $this->_data .= "\t\treturn \$this;\n"; $this->_data .= "\t}\n"; }
/** * Get generated data from our services */ public function getDataFromServices() { $createModule = false; $createAutoloaders = false; $createConfig = false; $createOptions = false; foreach (self::$tables as $table => $data) { // clean interface array foreach ($this->getSetting('types') as $type => $get_data) { if ($get_data) { // Quit if no primary key is set. if (isset($data['primary_key'])) { // set object names to Ucfirst then lowercase. $table = ucfirst(strtolower($table)); switch ($type) { case "create_entity": $EntityService = new EntityCreatorService(); $this->_data[$table]['entity'] = $EntityService->createEntity($table, $data); break; case "create_mapper": $MapperService = new MapperCreatorService(); $this->_data[$table]['mapper'] = $MapperService->createMapper($table, $data); break; case "create_service": $serviceCreator = new ServiceCreatorService(); $this->_data[$table]['service'] = $serviceCreator->createService($table, $data); $EventService = new EventCreatorService(); $this->_data[$table]['service_event'] = $EventService->createEventService($table, $data); break; case "create_module": $createModule = true; break; case "create_autoloaders": $createAutoloaders = true; break; case "create_config": $createConfig = true; break; case "create_options": $createOptions = true; break; default: die("Settings not set correctly. [types]"); break; } } } } } // Check if we want to create the module if ($createModule) { $moduleCreator = new ModuleCreatorService(); $this->_files['module'] = $moduleCreator->createModule($table, self::$tables); } // Check if we want to create the options file if ($createOptions) { $optionsCreator = new OptionsCreatorService(); $this->_files['options'] = $optionsCreator->createOptions($table); } // Check if we want to create the config if ($createConfig) { // Build config file $this->_files['config'] = "<?php\n"; $this->_files['config'] .= "return array(\n"; $this->_files['config'] .= "\t'service_manager' => array(\n"; $this->_files['config'] .= "\t\t'aliases' => array(\n"; $this->_files['config'] .= "\t\t\t'" . strtolower(self::getNamespace()) . "_zend_db_adapter' => 'Zend\\Db\\Adapter\\Adapter',\n"; $this->_files['config'] .= "\t\t),\n"; $this->_files['config'] .= "\t),\n"; $this->_files['config'] .= ");"; } // Check if we want to create the options file if ($createConfig) { // Build config file $this->_files['config'] = "<?php\n"; $this->_files['config'] .= "return array(\n"; $this->_files['config'] .= "\t'service_manager' => array(\n"; $this->_files['config'] .= "\t\t'aliases' => array(\n"; $this->_files['config'] .= "\t\t\t'" . strtolower(self::getNamespace()) . "_zend_db_adapter' => 'Zend\\Db\\Adapter\\Adapter',\n"; $this->_files['config'] .= "\t\t),\n"; $this->_files['config'] .= "\t),\n"; $this->_files['config'] .= ");"; } // Check if we want to create autoloaders if ($createAutoloaders) { // Build classmap file $this->_files['classmap'] = "<?php\n"; $this->_files['classmap'] .= "return array(\n"; $this->_files['classmap'] .= "\t'" . ZendModelCreator::getNamespace() . "\\Module' => __DIR__ . '/Module.php',\n"; $this->_files['classmap'] .= ");"; // Build function file $this->_files['function'] = "<?php\n"; $this->_files['function'] .= "return function (\$class) {\n"; $this->_files['function'] .= "\tstatic \$map;\n"; $this->_files['function'] .= "\tif (!\$map) {\n"; $this->_files['function'] .= "\t\t\$map = include __DIR__ . '/autoload_classmap.php';\n"; $this->_files['function'] .= "\t}\n"; $this->_files['function'] .= "\tif (!isset(\$map[\$class])) {\n"; $this->_files['function'] .= "\t\treturn false;\n"; $this->_files['function'] .= "\t}\n"; $this->_files['function'] .= "\treturn include \$map[\$class];\n"; $this->_files['function'] .= "};\n"; // Build register file $this->_files['register'] = "<?php\n"; $this->_files['register'] .= "spl_autoload_register(include __DIR__ . '/autoload_function.php');"; } }
/** * Generate persist method * */ private function _generatePersist($className) { // Set fetch function headers $this->_data .= "\t/**\n"; $this->_data .= "\t* Save a record\n"; $this->_data .= "\t*\n"; $this->_data .= "\t* @param object " . ZendModelCreator::getNamespace() . "\\Entity\\" . ucfirst(strtolower($className)) . "\n"; $this->_data .= "\t* @return object " . ZendModelCreator::getNamespace() . "\\Entity\\" . ucfirst(strtolower($className)) . "\n"; $this->_data .= "\t**/\n"; $this->_data .= "\tpublic function persist(" . ucfirst(strtolower($className)) . " \$" . strtolower($className) . ")\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\tif (\$" . strtolower($className) . "->get" . ZendModelCreator::toCamelCase($this->_primary_key) . "() > 0) {\n"; $this->_data .= "\t\t\t\$where = new Where;\n"; $this->_data .= "\t\t\t\$where->equalTo('" . $this->_primary_key . "', \$" . strtolower($className) . "->get" . ZendModelCreator::toCamelCase($this->_primary_key) . "());\n"; $this->_data .= "\t\t\t\$this->update(\$" . strtolower($className) . ", \$where, '" . strtolower($className) . "');\n"; $this->_data .= "\t\t} else {\n"; $this->_data .= "\t\t\t\$result = \$this->insert(\$" . strtolower($className) . ", '" . strtolower($className) . "');\n"; $this->_data .= "\t\t\t\$" . strtolower($className) . "->set" . ZendModelCreator::toCamelCase($this->_primary_key) . "(\$result->getGeneratedValue());\n"; $this->_data .= "\t\t}\n"; $this->_data .= "\t\treturn \$" . strtolower($className) . ";\n"; $this->_data .= "\t}\n\n"; }
/** * Generates header for Mapper class * */ private function _generateClassHeader($className) { $this->_data .= "<?php\n/**\n* file: " . ucfirst(strtolower($className)) . "Event.php\n* " . ucfirst(strtolower($className)) . " Event\n*\n* @author " . ZendModelCreator::getGenerator() . "\n* @version " . ZendModelCreator::getVersion() . "\n* @package " . ZendModelCreator::getNamespace() . "\n* @since " . date("Y-m-d") . "\n*/\n\nnamespace " . ZendModelCreator::getNamespace() . "\\Service;\n\nuse ArrayObject;\n\nuse " . ZendModelCreator::getNamespace() . "\\Entity\\" . $className . " as " . $className . "Entity;\n\nuse Zend\\EventManager\\Event;\n\n/**\n* " . ucfirst(strtolower($className)) . "Event\n*\n* @author " . ZendModelCreator::getGenerator() . "\n* @version " . ZendModelCreator::getVersion() . "\n* @package " . ZendModelCreator::getNamespace() . "\n* @since " . date("Y-m-d") . "\n*\n**/\nclass " . ucfirst(strtolower($className)) . " extends Event\n{\n"; }
private function _generateClassHeader() { $this->_data .= "<?php\n/**\n * ErrorContants used in the application\n * \n * @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n * @licence GNU/GPL V 1.0\n * @contact " . ZendModelCreator::getContact() . "\n * @since " . date("Y-m-d") . "\n *\n */\n\nclass ErrorConstants {\n"; }
private function _generateClassHeader($className) { $this->_data = "<?php\n/**\n * {$className}\n *\n * @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n * @licence GNU/GPL V 1.0\n * @contact " . ZendModelCreator::getContact() . "\n * @since " . date("Y-m-d") . "\n *\n */\n\n"; }
/** * Generate getters and setters used in the entity class * */ private function _generateClassGettersSetters($params) { foreach ($params as $param) { foreach ($param as $name => $type) { switch ($type[0]) { case self::$STRING: $this->_data .= $this->_getGetComment($type[0], $name); $this->_data .= "\tpublic function get" . ZendModelCreator::toCamelCase($name) . "()\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\treturn \$this->{$name};"; $this->_data .= "\n\t}\n\n"; $this->_data .= $this->_getSetComment($type[0], $name); $this->_data .= "\tpublic function set" . ZendModelCreator::toCamelCase($name) . "(\${$name})\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\t\$this->{$name} = \${$name};"; $this->_data .= "\n\t}\n\n"; break; case self::$INTEGER: $this->_data .= $this->_getGetComment($type[0], $name); $this->_data .= "\tpublic function get" . ZendModelCreator::toCamelCase($name) . "()\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\treturn \$this->{$name};"; $this->_data .= "\n\t}\n\n"; $this->_data .= $this->_getSetComment($type[0], $name); $this->_data .= "\tpublic function set" . ZendModelCreator::toCamelCase($name) . "(\${$name})\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\t\$this->{$name} = \${$name};"; $this->_data .= "\n\t}\n\n"; break; case self::$DATETIME: $this->_data .= $this->_getGetComment($type[0], $name); $this->_data .= "\tpublic function get" . ZendModelCreator::toCamelCase($name) . "()\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\treturn \$this->{$name};"; $this->_data .= "\n\t}\n\n"; $this->_data .= $this->_getSetComment($type[0], $name); $this->_data .= "\tpublic function set" . ZendModelCreator::toCamelCase($name) . "(\${$name})\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\t\$this->{$name} = \${$name};"; $this->_data .= "\n\t}\n\n"; break; case self::$DOUBLE: $this->_data .= $this->_getGetComment($type[0], $name); $this->_data .= "\tpublic function get" . ZendModelCreator::toCamelCase($name) . "()\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\treturn \$this->{$name};"; $this->_data .= "\n\t}\n\n"; $this->_data .= $this->_getSetComment($type[0], $name); $this->_data .= "\tpublic function set" . ZendModelCreator::toCamelCase($name) . "(\${$name})\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\t\$this->{$name} = \${$name};"; $this->_data .= "\n\t}\n\n"; break; case self::$ARRAY: $this->_data .= $this->_getGetComment($type[0], $name); $this->_data .= "\tpublic function get" . ZendModelCreator::toCamelCase($name) . "()\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\treturn \$this->{$name};"; $this->_data .= "\n\t}\n\n"; $this->_data .= $this->_getSetComment($type[0], $name); $this->_data .= "\tpublic function set" . ZendModelCreator::toCamelCase($name) . "(array \${$name})\n"; $this->_data .= "\t{\n"; $this->_data .= "\t\t\$this->{$name} = \${$name};"; $this->_data .= "\n\t}\n\n"; break; } } } }
// Create types $SETTINGS['types']['create_dto'] = true; $SETTINGS['types']['create_dao'] = true; $SETTINGS['types']['create_entity'] = true; $SETTINGS['types']['create_service'] = true; $SETTINGS['types']['create_interface'] = true; $SETTINGS['types']['create_errorconstants'] = true; $SETTINGS['types']['create_exception'] = true; $SETTINGS['types']['create_genericfiles'] = true; // MySQL settings $SETTINGS['mysql_host'] = "localhost"; $SETTINGS['mysql_user'] = "******"; $SETTINGS['mysql_password'] = ""; $SETTINGS['mysql_db'] = "zhn_db"; // Setup the model creator service with our specified settings $ZendModelCreator = new ZendModelCreator($SETTINGS); // Get the generated PHP code from our services $ZendModelCreator->getDataFromServices(); /** * Setup the directory structure you want to use, * these settings also affect the "require_once" statements * throughout the code, therefore you need to specify these * settings, even if you are not using the function * $ZendModelCreator->writePHPCreatedModelData(); */ $ZendModelCreator->setDirectoryStructure(array("ContainerDir" => "model", "DS" => dirname(__FILE__), "DirectoryStructure" => array('DTO' => 'api', 'DAO' => 'dao', 'ENT' => 'persistence', 'SRV' => 'service', 'INT' => 'api', 'EXC' => 'service', 'GEN' => 'db', 'CON' => 'constants'), "FileNames" => array('DTO' => '[tbl]DTO.php', 'DAO' => '[tbl]DAO.php', 'ENT' => '[tbl]Entity.php', 'SRV' => '[tbl]Service.php', 'INT' => 'I[tbl]Service.php', 'EXC' => '[tbl]ServiceException.php'))); /** * Either runt getPHPCreatedModelData to get the * data for each file outputted in an HTML <textarea> element. */ //$ZendModelCreator->getPHPCreatedModelData();
private function _generateClassHeader($className) { $className = strtolower($className); $this->_data .= "<?php\n/**\n * {$className}" . "ServiceException extends Exception\n * \n * @author ZendModelCreator " . ZendModelCreator::getVersion() . "\n * @licence GNU/GPL V 1.0\n * @contact " . ZendModelCreator::getContact() . "\n * @since " . date("Y-m-d") . "\n *\n */\n\nclass " . ucfirst(strtolower($className)) . "ServiceException extends Exception {\n\n\t/** \n\t * Constructor\n\t * @param string error message\n\t * @param int error code\n\t * @return void\n\t * @access public\n\t */\n"; }
/** * @package ZendModelCreator 2 * @copyright Copyright (C) 2012 Hussfelt Consulting AB. All rights reserved. * @license SEE LICENCE * **/ // Parameters used $parameters = array('host:', 'db:', 'user:'******'password:'******'without-entity::', 'without-mapper::', 'without-service::', 'namespace::'); // Get the parameters $options = getopt('', $parameters); // MySQL settings $SETTINGS['mysql_host'] = $options['host']; $SETTINGS['mysql_user'] = $options['user']; $SETTINGS['mysql_password'] = $options['password']; $SETTINGS['mysql_db'] = $options['db']; $SETTINGS['types']['create_entity'] = isset($options['without-entity']) && $options['without-entity'] == '1' ? false : true; $SETTINGS['types']['create_mapper'] = isset($options['without-mapper']) && $options['without-mapper'] == '1' ? false : true; $SETTINGS['types']['create_service'] = isset($options['without-service']) && $options['without-service'] == '1' ? false : true; $SETTINGS['types']['create_module'] = isset($options['without-module']) && $options['without-module'] == '1' ? false : true; $SETTINGS['types']['create_autoloaders'] = isset($options['without-autoloaders']) && $options['without-autoloaders'] == '1' ? false : true; $SETTINGS['types']['create_config'] = isset($options['without-config']) && $options['without-config'] == '1' ? false : true; $SETTINGS['types']['create_options'] = isset($options['without-options']) && $options['without-options'] == '1' ? false : true; $SETTINGS['namespace'] = isset($options['namespace']) && $options['namespace'] != '' ? $options['namespace'] : null; // Setup the model creator service with our specified settings require_once 'zmc/ZendModelCreator.php'; $zmc = new ZendModelCreator($SETTINGS); // Generate our data $zmc->getDataFromServices(); // Write to files $zmc->writePHPCreatedModelData();