Tuesday, June 29, 2010

fetch only ‘enabled’ records from the database in cakephp v1.3

Is there any way of fetching only those records of a model which have
'status = 1' in cakephp v1.3 ?

I have created a field named 'status' in every table of my web
application.

I have a model named 'Message'. What I want is that only those
messages are displayed, included in search results which have 'status
= 1'. Messages with a 'status = 0' won't be displayed and won't be
included in search results too.

How can I do this so that it is done for all models just like the way
we provide 'condition' in the $belongsTo array of model.

Please help me if I can do it the cakePHP way, for now as a temporary
solution I am using the 'status = 1' in the conditions array of every
find of messages.

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: