/** * Executes get<RM_Barcode_Entity type|RM_Gpc_Entity type> methods **/ public function __call($method, $args) { if (preg_match('/get(\\w+)/', $method, $match)) { $type = strtolower($match[1]); if (in_array($type, array_keys($this->_mapper->related_entities()))) { return $this->_mapper->loadById($type, $this->{$type . '_id'}); } else { if (in_array($type, M('Gpc')->entities())) { return M('Gpc')->{'load' . ucfirst($type) . 'ById'}($this->{$type . '_id'}); } } } throw new Exception("Unknown method `{$method}'"); }
/** * @see RM_Barcode_Mapper::related_entities() **/ public function related_entities() { return $this->_mapper->related_entities(); }