a tiny mvc framework for php using php-activerecord
at v1 37 lines 720 B view raw
1<?php 2class Venue extends ActiveRecord\Model 3{ 4 static $use_custom_get_state_getter = false; 5 static $use_custom_set_state_setter = false; 6 7 8 static $has_many = array( 9 'events', 10 array('hosts', 'through' => 'events') 11 ); 12 13 static $has_one; 14 15 static $alias_attribute = array( 16 'marquee' => 'name', 17 'mycity' => 'city' 18 ); 19 20 public function get_state() 21 { 22 if (self::$use_custom_get_state_getter) 23 return strtolower($this->read_attribute('state')); 24 else 25 return $this->read_attribute('state'); 26 } 27 28 public function set_state($value) 29 { 30 if (self::$use_custom_set_state_setter) 31 return $this->assign_attribute('state', $value . '#'); 32 else 33 return $this->assign_attribute('state', $value); 34 } 35 36}; 37?>