+ /**
+ * Returns the PHPtype used within the DAO object
+ *
+ * @param object $fieldXML
+ * @return string
+ */
+ private function getPhpType($fieldXML) {
+ $type = $fieldXML->type;
+ $phpType = $this->value('phpType', $fieldXML, 'string');
+
+ if ($type == 'int' || $type == 'int unsigned' || $type == 'tinyint') {
+ $phpType = 'int';
+ }
+
+ if ($type == 'float' || $type == 'decimal') {
+ $phpType = 'float';
+ }
+
+ if ($type == 'boolean') {
+ $phpType = 'bool';
+ }
+
+ if ($phpType !== 'string') {
+ // Values are almost always fetched from the database as string
+ $phpType .= '|string';
+ }
+
+ return $phpType;
+ }
+
+ /**
+ * Returns whether the field is nullable in PHP.
+ * Either because:
+ * - The SQL field is nullable
+ * - The field is a primary key, and so is null before new objects are saved
+ *
+ * @param object $fieldXML
+ * @return bool
+ */
+ private function getPhpNullable($fieldXML) {
+ $required = $this->value('required', $fieldXML);
+ if ($required) {
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+