Monday, June 29, 2009

RE: find with unrelated model

$result = ClassRegistry::init('Restriction')->find('all', array('conditions'
=>array('Restriction.badword' =>$wordtotest)));


HTH,

Paul


-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Dave
Sent: Tuesday, 30 June 2009 4:41 p.m.
To: CakePHP
Subject: find with unrelated model


I am trying to create a validation function where I check the
User.slug field against a tables of banned words

So if a user tries to use a slug "profile" it will come back invalid

I have Restrictions table with all banned words which is not related
to any model on the site.

How do I do a query from the users model to check restrictions table?

Tried App::Import('Model', 'Restriction'); method but all i get is
error -> Trying to get property of non-object


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4198 (20090629) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4198 (20090629) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


--~--~---------~--~----~------------~-------~--~----~
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: