In OOP theory you can have classes with loads of methods, as long as
it makes sense.
Controller methods can be collpsed by almost all editors.
Dont divide that controller that way. Dont worry with 500 lines of
PHP, as long as all methods are part of Users.
On Feb 14, 7:05 pm, sanemat <[EMAIL PROTECTED]> wrote:
> Thank you for your reply.
> Yes, I try to thin controllers, and most of business logics move to
> model.
>
> But my UsersController has register(), activate(), resign(), edit(),
> etc...
> It has over 500 lines PHP Code.
> So I want to divide it into small files which have less than 50-100
> lines code.
>
> On 2/14/08, am7:06, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > Why do yopu want to devide the controller methods ? the whole purpose
> > of a controller is to _group_ them. You should think about "fat model,
> > thin controllers" - do a search on that , also you might take a look
> > at editors wich support code folding - vim, eclipse and *many* others.
>
> > On 2/13/08, sanemat <[EMAIL PROTECTED]> wrote:
>
> > > Controllers which have many method (like users_controller) are liable
> > > to large.
>
> > > example:
> > > app/controllers/examples_controller.php
> > > class ExamplesController extends AppController {
> > > function index(){}
> > > function edit(){}
> > > function add(){}
> > > etc...
> > > }
>
> > > I want divide this into small file each method.
> > > But I don't know how to do it with CakePHP standard.
>
> > > Now I have 2 ideas.
> > > --start--
> > > add:
> > > app/controllers/examples_edit_controller.php
> > > class ExamplesEditController extends ExamplesController {
> > > function edit($id){
> > > //ExamplesController's edit() content write this.
> > > }
> > > }
> > > edit:
> > > app/config/rontes.php
> > > Router::connect('/example/edit/*', array('controller' =>
> > > 'examples_edit', 'action' => 'edit'));
> > > --end--
>
> > > or
>
> > > --start--
> > > add:
> > > app/controllers/examples/edit.php
> > > class ExamplesControllerEdit extends ExamplesController {
> > > function __construct($id){
> > > //ExamplesController's edit() content write this.
> > > }
> > > }
> > > edit:
> > > app/controllers/examples_controller.php
> > > class ExamplesController extends AppController {
> > > function edit($id){
> > > new ExamplesControllerEdit($id);
> > > }
> > > }
> > > --end--
>
> > > But I feel these ideas bad.
> > > Above idea I must write many Router::connect rules.
> > > It will confuse me.
> > > below one I must call many 'require_once' or 'App::import' in every
> > > place.
> > > It will also confuse me.
>
> > > Please give me some advice.
> > > thanks.
>
> > --
> > Marcin Domanskihttp://kabturek.info
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---