/** * Get the model namespace. If it's a sub-model, needs to be in the NS of its parent. * * @return string */ public function getNamespace() { if (isset($this->parent_model)) { return sprintf('%s\\%s', $this->getAPI()->getNamespace(), $this->parent_model->getClassName()); } else { return $this->getAPI()->getNamespace(); } }
/** * @return string */ public function getPHPType($with_ns = false) { switch ($this->getType()) { case Object::PROPERTY_TYPE_INT: return 'int'; case Object::PROPERTY_TYPE_FLOAT: return 'float'; case Object::PROPERTY_TYPE_BOOLEAN: return 'bool'; case Object::PROPERTY_TYPE_STRING: case Object::PROPERTY_TYPE_GUID: case Object::PROPERTY_TYPE_ENUM: return 'string'; case Object::PROPERTY_TYPE_DATE: return '\\DateTime'; case Object::PROPERTY_TYPE_OBJECT: return $this->related_object->getClassName($with_ns); } return null; }