1 2// Used for getting validation and save data 3$user = new user();
4 5// Get all the validation from the user model 6$model_validation = $user->get_validation_rules();
7 8// CodeIgniter form class 9$this->form_validation->set_rules('password', 'Password', 'required|min_length['10 .$model_validation['password']['validates_length_of']['minimum']
11 .']');
12
Subject: Fetch validation rules out of Models
A way to fetch validation rules out of Models @ https://github.com/kla/php-activerecord/issues/17
http://www.phpactiverecord.xyz/docs/ActiveRecord/Model#methodget_validation_rules
Example from User Mode validation rules output by get_validation_rules()
validation rules inside User Model:
Is there way to use get_validation_rules() without need to instantiate the User Model. However from the code it may not be possible.
You stated that your open to 'tweaking the returned array format'.
Current get_validation_rules() return format:
To converting the output into something that bit more clean to deal with is bit dirty.
New format:
This allows for cleaner looking code in
On a side note I love the php activerecords