Business-related DATA-connected logic is best residing in the Model, yes but there are still other considerations.
What if your logic was somehow VIew-related? For example you had to show some complex three-like structure and you wanted to pre-process it on the server?
A model would do of course, but you could also use a Helper to encapsulate the logic.
It all comes down to a developer's decision.
Get to know the life of a typical Cake Request. It contains the specific implementation details of MVC in CakePHP.
If you're putting your complex algorithm in a Model Class you could do so in a separate model - i.e. you do not need to put the logic in any specific model if it is not logically connected to only one Model.
You can have a "table-less model" in Cake just by setting the Model's $useTable property to FALSE or NULL.
Anyway anything is possible of course.
Cheers,
Borislav.
On Friday, 11 April 2014 15:27:07 UTC+3, Vitor Vezani wrote:
-- What if your logic was somehow VIew-related? For example you had to show some complex three-like structure and you wanted to pre-process it on the server?
A model would do of course, but you could also use a Helper to encapsulate the logic.
It all comes down to a developer's decision.
Get to know the life of a typical Cake Request. It contains the specific implementation details of MVC in CakePHP.
If you're putting your complex algorithm in a Model Class you could do so in a separate model - i.e. you do not need to put the logic in any specific model if it is not logically connected to only one Model.
You can have a "table-less model" in Cake just by setting the Model's $useTable property to FALSE or NULL.
Anyway anything is possible of course.
Cheers,
Borislav.
On Friday, 11 April 2014 15:27:07 UTC+3, Vitor Vezani wrote:
Hello guys, I want to do an app that will recommend itens for users, there will be a complex algorithm behind it, and seeing the structure of cake I m a little bit confuseIs this possible to do it in cackphp(I mean, any complex's algorithm)? If so, where would I put this algorithm? At the model or controller?Thanks guys!
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment