1. <?php
  2. abstract class Application_Model_Object_Abstract
  3. {
  4. protected $_db;
  5. protected $_name;
  6.  
  7. public function __construct() {
  8. $this->_db = Zend_Db_Table_Abstract::getDefaultAdapter();
  9. }
  10.  
  11. function __call($method, $arguments) {
  12.  
  13. $prefix = strtolower(substr($method, 0, 3));
  14. $property = '_' . strtolower(substr($method, 3));
  15.  
  16. if (empty($prefix) || empty($property)) {
  17. return;
  18. }
  19.  
  20. if ($prefix == "get" && isset($this->$property)) {
  21. if(isset($this->$property)) {
  22. return $this->$property;
  23. }
  24. }
  25.  
  26. if ($prefix == "set") {
  27. $this->$property = $arguments[0];
  28. return;
  29. }
  30.  
  31. trigger_error ("Fatal error: Call to undefined method test::$method()");
  32. }
  33.  
  34. }