Wednesday, December 30, 2009

Conceptual problem Model on View ..

Hi guys, im don't speak english but ill try to explain my problem for
u. So, sorry for my poor english.

Ok, let imagine that I have an Model named MODEL_A that have an status
field ( OPENED and CLOSED )..
I have an method on MODEL_A named can_close() that return true if i
can close the element..

I want to show a list of MODEL_A elements in the page.. so in the
controller I call a MODEL_A->find(all).. ok.. get all instances...and
$this->set to view... nice!

Ok, now i have all my MODEL_A elements on VIEW... and I want to do
this: foreach element check .. if MODEL_A->can_close() == true...
show button CLOSE .. on the side of element name.. if can_close() ==
false.. hide it.


So... a ill need to import my model to the view.. to call can_close
method.. right? but.. call model on view is the worst sin for MVC
pattern ahn??

So.. what I do now friends?

Thank you for all..

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: