function __call($name, $arguments) { if (empty($arguments)) { $descriptor = Model::getDescriptor($this->rowClass); $attachedMethod = $descriptor->getAttachedMethod($name); if (!$attachedMethod) { if (Inflector::isPlural($name)) { $attachedMethod = $descriptor->getAttachedMethod(Inflector::toSingular($name)); } } if ($attachedMethod) { $params = $attachedMethod->getParameters(); if (count($params) === 0) { return call_user_func(array($attachedMethod->object, $attachedMethod->method), $this); } } } throw new RecessException('Method "' . $name . '" does not exist on ModelSet nor is attached to ' . $this->rowClass . '.', get_defined_vars()); }
public static function labelForObjectProperty($object, $field) { $descriptor = Model::getDescriptor(get_class($object)); $property = isset($descriptor->properties[$field]) ? $descriptor->properties[$field] : new stdClass(); return isset($property->label) ? $property->label : Inflector::toProperCaps($field); }