Reputation: 4304
I'm taking over a site that's gone through several developers. The site is using Zend version 1.12.0, according to Zend_Version::VERSION
, which is a new framework for me. On the site, there's a form class called App_Form_Customers_Edit
, which extends Zend_Form
. The form's action is /customers/edit, and when submitted, the method editAction of CustomersController
is executed.
So, to create a new form, I created a new class App_Form_Customers_EditAddress
in the same directory as App_Form_Customers_Edit
, and set it's action to /customers/editaddress
, created a function called editaddressAction
in the CustomersController
class and tested the form.
But I get an error saying "Resource 'customers::editaddress' not found"
The form itself is displaying properly, and as far as I can tell I'm using the exact same pattern as the other form which works, and apart from not using the zf command, the same method prescribed here in the Zend documentation: http://framework.zend.com/manual/1.12/en/learning.quickstart.create-form.html
What do I need to do to get my new form working? Do I need to update .zfproject.xml
? I can't see anything in there that's related to the working form.
Here's the code for App_Form_Customers_Edit
:
class App_Form_Customers_Edit extends Zend_Form
{
public function init ()
{
$this->addPrefixPath('App_Form', 'App/Form/');
$this->setMethod('post');
// ... The rest is just calls to $this->addElement
}
}
And for EditAddress
:
class App_Form_Customers_EditAddress extends Zend_Form
{
public function init ()
{
$this->addPrefixPath('App_Form', 'App/Form/')
->setMethod('post')
->setAction('/customers/editaddress');
$this->addElement('submit', 'active', ['value' => 'Activate']);
$this->addElement('submit', 'remove', ['value' => 'Remove']);
$this->addElement('hidden', 'id');
}
}
Upvotes: 2
Views: 156
Reputation: 169
Check for acl declarations. If you are using acl and you have not declared rules for the action, you might get this type of error.
Upvotes: 1
Reputation: 8519
Best guess:
Your former developer has implemented a custom route somewhere. Probably in the application.ini or the boostrap.php. This custom route is looking for specific urls and /customers/edit
conforms to a valid route but /customers/editaddress
does not.
I think this is likely because your error is a missing resource rather then a 'page not found' or a missing controller or missing action message. So it seems as though the router is trying to match an invalid resource to a valid route.
Good Luck
Upvotes: 0