diff --git a/CHANGELOG b/CHANGELOG index a25c069..d43b178 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +3.10.1 (unreleased): + * Fix: autoincrement fields are now properly registered when using attributes + 3.10.0 (2025-03-14): * Feature: Allow complex types to be handled by symfony/serializer if available * Feature: Leverage dependency injection for Serializers diff --git a/src/TingBundle/DependencyInjection/TingExtension.php b/src/TingBundle/DependencyInjection/TingExtension.php index bcce466..6f36cab 100644 --- a/src/TingBundle/DependencyInjection/TingExtension.php +++ b/src/TingBundle/DependencyInjection/TingExtension.php @@ -191,7 +191,7 @@ function getMetadata(\ReflectionClass $reflector, Table $attribute): Definition 'columnName' => $mappingAttribute->getArguments()['column'] ?? strtolower(preg_replace('/[A-Z]/', '_\\0', lcfirst($property->getName()))), // snake case by default in database ]; if ($mappingAttribute->getArguments()['autoIncrement'] ?? false) { - $newField['autoIncrement'] = true; + $newField['autoincrement'] = true; } if ($mappingAttribute->getArguments()['primary'] ?? false) { $newField['primary'] = true; diff --git a/tests/units/TingBundle/DependencyInjection/TingExtension.php b/tests/units/TingBundle/DependencyInjection/TingExtension.php index ebe2a2d..6129134 100644 --- a/tests/units/TingBundle/DependencyInjection/TingExtension.php +++ b/tests/units/TingBundle/DependencyInjection/TingExtension.php @@ -65,7 +65,7 @@ public function testAutoConfigurationWithAttributes() ['setConnectionName', ['default']], ['setRepository', ['default']], ['addField', [ - ['fieldName' => 'id', 'columnName' => 'id', 'autoIncrement' => true, 'primary' => true, 'type' => 'int']] + ['fieldName' => 'id', 'columnName' => 'id', 'autoincrement' => true, 'primary' => true, 'type' => 'int']] ], ['addField', [['fieldName' => 'fieldWithSpecifiedColumnName', 'columnName' => 'field', 'type' => 'string']]], ['addField', [['fieldName' => 'fieldAsCamelCase', 'columnName' => 'field_as_camel_case', 'type' => 'string']]],