Re: Does calling model methods from elements break MVC pattern?

2008-10-05 Thread Kappa
First of all, i must admit that this discussion is becoming very interesting, because i often find myself thinking if the way i'm doing something with CakePHP is actually the right way. My suggestion in using the after_find was just an example of a restricted case, but I think that it's not the t

Re: Does calling model methods from elements break MVC pattern?

2008-10-05 Thread skylar
I'm really curious about this topic as well as it speaks to an aspect of the CakePHP Model class that has never really clicked with me. Andrea's example is perfect for explaining the point. In most MVC frameworks, when you retrieve data from storage (ram, db, file, etc), you usually get an instan

Re: Does calling model methods from elements break MVC pattern?

2008-10-04 Thread Kappa
You are right, but the fact is that in this case we are merging more principles, and the correct thing (as far as design is concerned) in my opinion is to let the product to deal with its own responsibilities as well, but invoke those operations from the controller and not from the view. In that w

Re: Does calling model methods from elements break MVC pattern?

2008-10-03 Thread ORCC
> > ..the comment "PERFORM BUSINESS LOGIC" should immediately > let you think that something is not 100% MVC ..you are > performing LOGIC inside a MODEL, and not just model data > handling. So, where I have to do the business logic? For example, I have a Product Object, and the product has some

Re: Does calling model methods from elements break MVC pattern?

2008-10-03 Thread Kappa
hi everybody, I'm not a MVC guru,but in my opinion, the fact that a view can import something and invoke actions not performed by a controller, but from a model, breaks somehow the MVC pattern. Maybe if you need some action to manipulate data of a model before display them, you should use the afte

Re: Does calling model methods from elements break MVC pattern?

2008-10-03 Thread Kappa
hi everybody, I'm not a MVC guru,but in my opinion, the fact that a view can import something and invoke actions not performed by a controller, but from a model, breaks somehow the MVC pattern. Maybe if you need some action to manipulate data of a model before display them, you should use the afte

Re: Does calling model methods from elements break MVC pattern?

2008-10-02 Thread ORCC
Ok, that means that I would consider to pass parameters to my elements (parameters calculated inside the controller) to avoid a requestAction call, doesn't it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePH

Re: Does calling model methods from elements break MVC pattern?

2008-10-02 Thread Samuel DeVore
> Mark Story provides details of a solution around requestaction (though this > method also has its critics) > http://mark-story.com/Posts/view/reducing-requestaction-use-in-your-cakephp-sites-with-fat-models > yea but since it is MarkStory Day you can't critique him right now. So using that meth

Re: Does calling model methods from elements break MVC pattern?

2008-10-02 Thread Sam Sherlock
> > Does calling model methods from elements break MVC pattern? yep. Views are for laying out stuff. controllers for pasing data to view and models for obtaining data. If your model passes the data to the controller so that the controller has to process the data as little as possible f

Does calling model methods from elements break MVC pattern?

2008-10-02 Thread ORCC
It is a question about MVC pattern in cakephp. I have a calculated value that I want to display in many views, so I decided to create an element. The business logic has to be performed in the model, i.e: models/product.php class Product extends AppModel { //... all attributes and methods