public function create($resourceName, $module = null) { parent::create($resourceName . 's', true, $module); $this->_resourceName = $resourceName; $this->_moduleName = $module; $modelProvider = new Zend_Tool_Project_Provider_Model(); $modelProvider->setRegistry($this->_registry); $modelProvider->create($this->_resourceName, $this->_moduleName); $dbTableProvider = new Zend_Tool_Project_Provider_DbTable(); $dbTableProvider->setRegistry($this->_registry); $dbTableProvider->create($this->_resourceName, $this->_resourceName . 's', $this->_moduleName); $formProvider = new Zend_Tool_Project_Provider_Form(); $formProvider->setRegistry($this->_registry); $formProvider->create($this->_resourceName, $this->_moduleName); $response = $this->_registry->getResponse(); try { $controllerResource = self::createResource($this->_loadedProfile, $resourceName, $module); //index created on superclass::create $this->_createAction('new'); $this->_createAction('edit'); $this->_createAction('destroy'); /* $testControllerResource = Zend_Tool_Project_Provider_Test::createApplicationResource( $this->_loadedProfile, $name, 'update', $module); $response->appendContent('Creating a controller test file at ' . $testControllerResource->getContext()->getPath()); $testControllerResource->create();*/ } catch (Exception $e) { $response->setException($e); return; } }
/** * Updates the generated form with the properties of the model as fields * * @param Registry $registry * @param Profile $profile * @param string $entity * @param string $commaSeparatedFields * @param string $module */ public static function create(Registry $registry, Profile $profile, $entity, $commaSeparatedFields = '', $module = null) { $form = new FormProvider(); $form->setRegistry($registry); $form->create("{$entity}Form"); $formResource = FormProvider::createResource($profile, "{$entity}Form", $module); $formPath = $formResource->getContext()->getPath(); $formContent = file_get_contents($formPath); file_put_contents($formPath, str_replace(' /* Form Elements & Other Definitions Here ... */', self::_getFormElements($commaSeparatedFields), $formContent)); }