MongoID in rules array?

42 views
Skip to first unread message

Paul deGrandis

unread,
Nov 3, 2011, 4:33:43 PM11/3/11
to YiiMongoDbSuite
Hi,

I want add a rule to the rules array that checks to make sure that one
of the fields is a MongoId, but for the life of me I can't figure it
out. Is there a shorthand for doing a type validation in yii that
takes a class or a MongoId validator in YMDS?

Thanks,
Paul

Attila Nagy

unread,
Nov 4, 2011, 4:37:15 AM11/4/11
to yiimong...@googlegroups.com

Hi,

I don't think this is a YMDS specific question, it's more a general
Yii validation problem. Here you'll find a list of Yii built-in
validators:
http://www.yiiframework.com/wiki/56/

unfortunately there's none that would fulfill your request, so you'll
need to write a custom validator. You can find more about this topic
here:

http://www.yiiframework.com/doc/guide/1.1/en/form.model#declaring-validation-rules

if you need to reuse this rule in different models, then I'd prefer to
build a validator class for this task.

--
Nagy Attila Gabor

Reply all
Reply to author
Forward
0 new messages