public function __call($name, $arguments) { if ($this->is_applying_sort($name) || $this->is_applying_filter($name)) { return parent::__call($name, $arguments); } switch ($name) { case "get{$this->managed_object}s": case "get{$this->managed_object}es": case "get" . substr($this->managed_object, 0, -1) . "ies": return $this->getManagedObjects(); case "getFirst{$this->managed_object}": if (reset($this->getManagedObjects()) === false) { return; } else { return reset($this->getManagedObjects()); } case "getTotal": return $this->getManagedObjectCount(true); case "get{$this->managed_object}Count": case "getSize": return $this->getManagedObjectCount(); break; } trigger_error("Call to undefined method DBObjectCollection->{$name}() on {$this->managed_object}"); //Debugger::log("DBObjectCollection __call($name)"); }
public function __call($name, $arguments) { if ($this->is_applying_sort($name) || $this->is_applying_filter($name)) { return parent::__call($name, $arguments); } $this->getManagedObjectData(); $lower_name = strtolower(str_replace('_', '', $name)); //Debugger::log($this->managed_object_data); foreach ($this->managed_object_data as $function => $function_data) { foreach ($function_data as $column => $column_data) { if ($lower_name == strtolower(str_replace('_', '', "get{$function}For{$column}"))) { return $column_data; } else { //error_log($lower_name . " != " . strtolower(str_replace('_', '', "get{$function}For{$column}"))); Debugger::log($lower_name . " != " . strtolower(str_replace('_', '', "get{$function}For{$column}"))); } } } //exit; switch ($name) { case "get{$this->managed_object}s": return $this->getManagedObjects(); case "getTotal": return $this->getManagedObjectCount(true); case "get{$this->managed_object}Count": case "getSize": return $this->getManagedObjectCount(); break; } trigger_error("Call to undefined method DBStatistics->{$name}()"); //error_log(print_r($this->managed_object_data,true)); //Debugger::log("DBObjectCollection __call($name)"); }