The issue is your code not the framework. ;) No matter what framework 
you're going to use, if you put all your code into controllers this won't 
work out very well in Zend or Symphony as well. Also Cake does not force 
you to do anything in a completely strict way, everything can be changed 
but you won't make your live more easy by not following the conventions. 
Cake definitely doesn't force you to put code into controllers, that's 
plain wrong. 

I guess you don't do unit testing, which is not good. Unit testing is a 
must have, specially for big projects. I guess that because of your heavy 
controllers, in fact controllers should by tiny and models fat. Models have 
plenty of advantages, they can be shared between different controllers and 
shell scripts while a controller method can't be shared that way. Also 
testing models is easier than testing controllers. As rchavik already 
pointed out lookup costume find methods in the book. If properly build it 
should be also possible for you to create submodules, plugins for parts of 
your applications that can be shared. Check the 
https://github.com/cakedc/comments comments plugin for example. It 
encapsulates all the comment code in a plugin and can be implemented within 
~1-2 hours in any application.

Your code piece here that you put in the controller should be in fact a 
model method. You can always pass args from the request object to a model 
method. Even if the method can't be shared with another application for 
some reason, it should go into the model.

If you want objects returned in 2.0 there is a plugin for that as well, 
just google it.

If you want you can do a training session with us 
http://www.cakedc.com/training, besides basic Cake lessons we can also have 
a class about design patterns and best practice as well.

On Sunday, November 10, 2013 3:51:26 PM UTC+1, Ighor Martins wrote:
>
>
> This will be an application, with a custom software design. And CakePHP 
> almost force us to follow it's strict design. At the same time, this 
> platform won't require that enough for me to move to something like Zend. 
>
> So, I have knowledge about Cake, but I don't really know the best 
> practices to develop big applications with Cake. Only normal websites.
> Sometimes I even feel like cake almost force us grow our controllers code 
> instead of models, and that's what's making me sad.
> To give you an example:
> I normally do things like this on controllers:
> $this->MyModel->find('all', array(
>   'contain' => array(
>      'SecondLevelThing' => array(
>        'ThirdLevelThing' => array(
>           'conditions' => 'thirdLevelThingConditions'
>        ),
>        'conditions' => 'secondLevelThingConditions' 
>      )
>   )
> ));
>
> I know CakePHP 3 will be there in a while to solve some of these issues, 
> and it will finally return objects instead of arrays :)
> but for now, how is the best design pattern to follow with CakePHP when 
> developing big applications without fighting against the framewok?
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to