Page 1 of 1

Zend and default indexAction()

Posted: Wed May 06, 2009 10:48 am
by alex.barylski
I have a custom routing table setup but I still also have indexAciton() methods.

Do I need them or can I drop them? None of my routes (that I know of) point to that function

Ideally all my actions are well named and fit a specific purpose so I would prefer to drop it outright. Problems?

EDIT | In addition to the above assume I have a controller:action like...

Code: Select all

MyCustomObject::updateProfileAction()
Using a custom routing table can I drop the 'Action' part of the method?

Given a XML route like:

Code: Select all

  <example>    <route>/:title/:page</route>    <defaults>      <controller>custom-object</controller>      <action>update-profile-action</action>    </defaults>  </example> 
Would the above be accurate? Or would I use the actual class name and method -- which would make more sense anyways.

Cheers,
Alex

Re: Zend and default indexAction()

Posted: Wed May 06, 2009 11:19 pm
by alex.barylski
Bump! I'm starting to think this was the wrong forum to post a question in :P

Re: Zend and default indexAction()

Posted: Wed May 06, 2009 11:29 pm
by John Cartwright
PCSpectra wrote:Bump! I'm starting to think this was the wrong forum to post a question in :P
Your right :).

Moved to PHP - Theory and Design.

P.S., please wait at least 24 hours before bumping.

Re: Zend and default indexAction()

Posted: Thu May 07, 2009 2:41 am
by Eran
I'm not really sure what the question is.. if you don't have links that reach the index action, you don't need it, it's just a convenient default

I'm not really familiar with the XML syntax for routes, but using arrays you just put the names of the controller / action so I imagine it's the same? you just have to test and see for yourself.

As a side note, Zend recommends having the action name in lowercase. If you want camelCase actions, you will need to seperate those with a '-' or a '.' in the URL. Read the case naming conventions on this page - http://framework.zend.com/manual/en/zen ... asics.html

Re: Zend and default indexAction()

Posted: Thu May 07, 2009 4:53 pm
by alex.barylski
you want camelCase actions, you will need to seperate those with a '-' or a '.' in the URL. Read the case naming conventions on this page
I figured that out eventually...