public function testGenerate() { error_reporting(E_ALL); $codeGenerator = new CodeGenerator(self::$_db, 'Generation', self::$_base . 'Generation/'); $codeGenerator->generateModels(); $codeGenerator->generateStores(); $codeGenerator->generateControllers(); $this->assertFileExists(self::$_base . 'Generation/Model/Base/UnoBase.php'); $this->assertFileExists(self::$_base . 'Generation/Model/Base/DosBase.php'); $this->assertFileExists(self::$_base . 'Generation/Model/Base/TresBase.php'); $this->assertFileExists(self::$_base . 'Generation/Store/Base/UnoStoreBase.php'); $this->assertFileExists(self::$_base . 'Generation/Store/Base/DosStoreBase.php'); $this->assertFileExists(self::$_base . 'Generation/Store/Base/TresStoreBase.php'); $this->assertFileExists(self::$_base . 'Generation/Controller/Base/UnoControllerBase.php'); $this->assertFileExists(self::$_base . 'Generation/Controller/Base/DosControllerBase.php'); $this->assertFileExists(self::$_base . 'Generation/Controller/Base/TresControllerBase.php'); $this->assertFileExists(self::$_base . 'Generation/Model/Uno.php'); $this->assertFileExists(self::$_base . 'Generation/Model/Dos.php'); $this->assertFileExists(self::$_base . 'Generation/Model/Tres.php'); $this->assertFileExists(self::$_base . 'Generation/Store/UnoStore.php'); $this->assertFileExists(self::$_base . 'Generation/Store/DosStore.php'); $this->assertFileExists(self::$_base . 'Generation/Store/TresStore.php'); $this->assertFileExists(self::$_base . 'Generation/Controller/UnoController.php'); $this->assertFileExists(self::$_base . 'Generation/Controller/DosController.php'); $this->assertFileExists(self::$_base . 'Generation/Controller/TresController.php'); }
public function execute(InputInterface $input, OutputInterface $output) { unset($input, $output); $connection = Database::getConnection(); $namespaces = Config::getInstance()->get('app.namespaces'); $paths = Config::getInstance()->get('Octo.paths.namespaces'); $gen = new Database\CodeGenerator($connection, $namespaces, $paths, true); $gen->generateModels(); $gen->generateStores(); }
/** * Generates Model and Store classes by reading database meta data. */ protected function execute(InputInterface $input, OutputInterface $output) { $gen = new CodeGenerator(Database::getConnection(), array('default' => 'PHPCI'), array('default' => PHPCI_DIR), false); $gen->generateModels(); $gen->generateStores(); }