diff --git a/src/Command/BuildCommand.php b/src/Command/BuildCommand.php index 76a9a97..5340a40 100644 --- a/src/Command/BuildCommand.php +++ b/src/Command/BuildCommand.php @@ -477,6 +477,24 @@ public function buildSingleObject($data, $type, $isConflictResolution = false) { $catName = $data['category']; $data['category'] = $this->getCategoryId($catName); } + + // Make sure default value is applied to empty tinyint fields + foreach ($object->_fieldMeta as $key => $value) { + if ($value['dbtype'] == 'tinyint') { + $excludes = (isset($type['exclude_keys']) && is_array($type['exclude_keys'])) ? $type['exclude_keys'] : array(); + + // Skip fields that are explicitly defined OR excluded in YAML config + if (isset($data[$key]) || in_array($key, $excludes)) continue; + + // Reset fields with a value other than the default + if (isset($value['default']) && $object->get($key) != $value['default']) { + if ($this->output->isVerbose()) { + $this->output->writeln("- Resetting $key field to default value for " . $object->get('name') . " object."); + } + $data[$key] = $value['default']; + } + } + } } $object->fromArray($data, '', true, true);