Book.php 627 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. class 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. public function upper_name()
  8. {
  9. return strtoupper($this->name);
  10. }
  11. public function name()
  12. {
  13. return strtolower($this->name);
  14. }
  15. public function get_name()
  16. {
  17. if (self::$use_custom_get_name_getter)
  18. return strtoupper($this->read_attribute('name'));
  19. else
  20. return $this->read_attribute('name');
  21. }
  22. public function get_upper_name()
  23. {
  24. return strtoupper($this->name);
  25. }
  26. public function get_lower_name()
  27. {
  28. return strtolower($this->name);
  29. }
  30. };
  31. ?>