jpfuentes2 / php-activerecord

ActiveRecord implementation for PHP
http://www.phpactiverecord.org/
Other
1.32k stars 443 forks source link

validators on non standard (legacy) column names #154

Open paulccarey opened 13 years ago

paulccarey commented 13 years ago

Hi

I think this may be a bug (or feature), not sure!

Anyway when specifying validators (not checked all but I presume so) on attributes that do not follow the standard naming schema expected an exception is thrown because the attribute cant be found.

static $validates_uniqueness_of = array(
    array("screenName")
);

There is obviously some sort of translation going on internally so if the validator is specified in normal form it works,

static $validates_uniqueness_of = array(
    array("screenname")
);

I think this should either be documented or the validators should allow and possibly internally translate the specified attributes.

greut commented 13 years ago

Can you write a test case for this? Validations should use the same inflection rules than Column.

I shouldn't be hard to fix that btw, but tests would be great.