a tiny mvc framework for php using php-activerecord
1<?php
2class RmBldg extends ActiveRecord\Model
3{
4 static $table = 'rm-bldg';
5
6 static $validates_presence_of = array(
7 array('space_out', 'message' => 'is missing!@#'),
8 array('rm_name')
9 );
10
11 static $validates_length_of = array(
12 array('space_out', 'within' => array(1, 5)),
13 array('space_out', 'minimum' => 9, 'too_short' => 'var is too short!! it should be at least %d long')
14 );
15
16 static $validates_inclusion_of = array(
17 array('space_out', 'in' => array('jpg', 'gif', 'png'), 'message' => 'extension %s is not included in the list'),
18 );
19
20 static $validates_exclusion_of = array(
21 array('space_out', 'in' => array('jpeg'))
22 );
23
24 static $validates_format_of = array(
25 array('space_out', 'with' => '/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i' )
26 );
27
28 static $validates_numericality_of = array(
29 array('space_out', 'less_than' => 9, 'greater_than' => '5'),
30 array('rm_id', 'less_than' => 10, 'odd' => null)
31 );
32}
33?>