-- Mr.nuub <[email protected]> wrote
(on Monday, 15 August 2011, 07:59 AM -0700):
> Hello everyone,
>
> Since a few months, I'm learning object oriented programming in PHP. Read
> lots of tutorials on the net, but I'm also reading the book "PHP Objects,
> Patterns, and Practice" at the moment.
>
> I am told that an object should use a noun as classname.
>
> Example:
>
> class User
> - function register
> - function login
> - function forgetPassword
>
> But in Zend tutorials, I see a lot of this:
>
> class LoginController
> class RegisterController
>
> Which way is right? Or has this something to do with the MVC pattern?
They're both correct. The Latter are controllers in the ZF MVC layer,
which follow a specific naming convention, and contain one or more
"action" methods (suffixed with "Action"). These then map to the URL --
in the above, they'd likely have a single "indexAction()" method,
allowing URLs like this:
http://example.com/login
http://example.com/register
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]