ZF-9343: zf create form failes with "Fatal error: Call to a member function search() on a non-object in library/Zend/Tool/Project/Provider/Form.php on line 70"

Description

{{zf create form}} failes with {{"Fatal error: Call to a member function search() on a non-object in library/Zend/Tool/Project/Provider/Form.php on line 70"}}

cause: formsDirectory resource is not created!

strange: in the default profile formsDirectory is disabled, but there is no enable function

workaround:

add lines marked with '+' in 'library/Zend/Tool/Project/Provider/Form.php'

// determine if testing is enabled in the project $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile);

  •  // create forms directory if it doesn't exist
    
  •  if (!($formsDirectory = self::_getFormsDirectoryResource($this->_loadedProfile, $moduleName))) {
    
  •      $applicationDirectory = $this->_loadedProfile->search('applicationDirectory');
    
  •      $formsDirectory = $applicationDirectory->createResource('formsDirectory');
    
  •  }
    
    if (self::hasResource($this->_loadedProfile, $name, $module)) {
    
        throw new Zend_Tool_Project_Provider_Exception('This project already has a form named ' . $name);
    
    }
    

hopefully this helps

Comments

Cannot reproduce this. When using

zf create form

I am asked to enter the name of the form. Normally the form name should be added like such

zf create form MyForm

Could you please verify if this error still occurs?

Thank you so much! Is there anyway to fix the initial zf create project so it creates a form directory from the start?

Please, to reproduce this error the command:

zf create form Login Users

"Fatal error: Call to a member function search() on a non-object in library/Zend/Tool/Project/Provider/Form.php on line 70"

Use zf enable form (module)

to create that directory.

Fixed in r23207 in trunk and r23208 in release branch 1.11