FuelPHP Bin
Sign in
Url:
Fork
<?php class Model_Levelplan extends \Orm\Model { protected static $_properties = array( 'id', 'building_id', 'level_id', 'key', 'value', 'created_at', 'created_by', 'updated_at', 'updated_by', ); protected static $_belongs_to = array( 'building' => array( 'key_from' => 'building_id', 'model_to' => 'Model_Building', 'key_to' => 'id', 'cascade_save' => true, 'cascade_delete' => false, ) ); protected static $_observers = array( 'Orm\Observer_CreatedAt' => array( 'events' => array('before_insert'), 'mysql_timestamp' => false, ), 'Observer_CreatedBy' => array( 'events' => array('before_insert'), 'mysql_timestamp' => false, ), 'Orm\Observer_UpdatedAt' => array( 'events' => array('before_save'), 'mysql_timestamp' => false, ), 'Observer_UpdatedBy' => array( 'events' => array('before_save'), 'mysql_timestamp' => false, ), 'Observer_LevelId' => array( 'events' => array('before_save'), 'mysql_timestamp' => false, ), ); public static function validate($factory) { $val = Validation::forge($factory); $val->add_field('building_id', 'Building', 'required'); $val->add_field('level_id', 'Level', 'required'); $val->add_field('key', 'Key', 'required|max_length[255]'); $val->add_field('value', 'Value', 'required|max_length[255]'); return $val; } }