Hi guys im having a spot of bother, hope someone can shed some light on this.
For some strange reason my route comes up saying action does not exist unless i change the camel casing to all lower case for that actions name then it works fine. but then that goes against the naming conventions! and i dont want to make my code sloppy either.
Heres my route:
$FrontController = Zend_Controller_Front::getInstance();
$Router = $FrontController->getRouter();
$Router->addRoute("artistsave",
new Zend_Controller_Router_Route
(
"artist/save-artist",
array(
"controller"=>"artist",
"action" =>"saveArtist"
)
)
);
Now to me this should look in the ArtistController for the action saveArtistsAction, but it doesn't it throws up this error:
Whoops you encountered the below error. Action "saveartist" does not exist and was not trapped in __call()
So it appears to have removed my camel casing in the router as the a for Artist is now lower case in the error and if i rename my action to match that, it works!
Any idea's why it is not looking for saveArtist?
I realise I could just rename it to save as it is part of the artist object but now I have found this I would like to understand before coming unstuck some other time in the future.
Thanks in advance to any help :)
No soon as I sent this I figured it out, but I feel others may fall for the same mistake so best to leave this here and tell the solution!
In the router it is still in URL formatting I was meant to use hyphens not camel casing then the framework works it out. so here is my correction/solution:
$Router->addRoute("artistsave",
new Zend_Controller_Router_Route
(
"artist/save-artist",
array(
"controller"=>"artist",
"action" =>"save-artist"
)
)
);
Happy coding :)