Dimitris Romeo Havlidis Sat Sep 10 01:55:44 -0400 2011

Subject: Using record names without prefixes

Good day guys

I am in the habbit of using a prefix on my records to signify the table that the record belongs to
for example in the users table user_name, user_password, user_lastlogin etc.

The problem is that when I am using PHPAR I have to code like $user->user_name which is a bit repititive and ugly

Is there anyway to set the prefic of the table records in order to only have to write $user->name ?


Clay vanSchalkwijk Sun Sep 11 17:48:12 -0400 2011

You can't globally set a prefix for the fields int he model, but you can setup aliases in your models which is just a one-time setup anyways.

http://www.phpactiverecord.org/docs/ActiveRecord/Model#var$alias_attribute

(1-1/1)