I am trying to create a search function and paginate the results. For all the standard fields, this is an easy task. I have one situation that is causing me a ton of headaches and any help you can give is most appreciated. Here is the setup:
Registrations - hasMany RegistrationCodes RegistrationCodes -belongsTo Registration -belongsTo Code -this table has the fields registration_id and code_id Codes -hasMany RegistrationCodes So most registrations have no more than 2 codes, the code it self is stored in the codes table, and information about the codes is stored in the registration codes table(ex: type of code, registration_id, etc...). There are a lot of pirated codes so it makes sense to store the code once and keep track of the info and linking in the registration codes table. I am searching over the standard fields in Registrations, name, email, phone, etc... and the only field I'm searching for that is outside the table is the code. Now I want to be able to enter a code in the search bar and have the results lumped in with all the other results, but I am having huge issues doing this. Since cake doesn't automatically enter in the table from hasMany results I need to do some cake magic. This doesn't work: $conditions[] = array('Code.code LIKE' => $this->data['Registration'] ['search']."%"); I have looked in to containbles but I'm not sure I understand this at all. I also thought of trying to do stuff in the beforeFind method but I can't find any good help on that. Would this help with pagination? Is it possible to create temporary fields in the Registration table and populate it with the codes? Then search over that? Can someone point me in the right direction here, I am very lost and need help. Any help is most appreciated. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---