a tiny mvc framework for php using php-activerecord
at v1 36 lines 627 B view raw
1<?php 2class Book extends ActiveRecord\Model 3{ 4 static $belongs_to = array('author'); 5 static $has_one = array(); 6 static $use_custom_get_name_getter = false; 7 8 public function upper_name() 9 { 10 return strtoupper($this->name); 11 } 12 13 public function name() 14 { 15 return strtolower($this->name); 16 } 17 18 public function get_name() 19 { 20 if (self::$use_custom_get_name_getter) 21 return strtoupper($this->read_attribute('name')); 22 else 23 return $this->read_attribute('name'); 24 } 25 26 public function get_upper_name() 27 { 28 return strtoupper($this->name); 29 } 30 31 public function get_lower_name() 32 { 33 return strtolower($this->name); 34 } 35}; 36?>