I have two models that I would like to save in the same table.
For instance I have a status model and a payschedule model both should be saved in the statuses table. But at retrieving the status model should return only the records with payment = ‘no’ and the payschedule only records with payment = ‘yes’.
I will have a before save in each model to make sure that the correct payment value is saved to the table.
My question is how can I restrict the retrieval from the table on the model to the constraints explained above without having to do it at each find() operation?
ps I you have not figured it out, I am a CakePHP noob.
It should be possible to implement this in the find() method of your model:
edit:
To follow the CakePHP recommendation, it should probably be implemented in the function beforeFind() instead: http://book.cakephp.org/view/1049/beforeFind