Skip to content

Commit 0705529

Browse files
committed
bug #648 [AI Bundle] Fix null model names (OskarStark)
This PR was squashed before being merged into the main branch. Discussion ---------- [AI Bundle] Fix null model names | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | no | Issues | Follows #577 | License | MIT Commits ------- b527ecb [AI Bundle] Fix null model names
2 parents fea5ba9 + b527ecb commit 0705529

File tree

3 files changed

+46
-50
lines changed

3 files changed

+46
-50
lines changed

src/ai-bundle/config/options.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
->thenInvalid(\sprintf('The model class "%%s" must extend %s.', Model::class))
191191
->end()
192192
->end()
193-
->stringNode('name')->defaultNull()->end()
193+
->stringNode('name')->isRequired()->end()
194194
->arrayNode('options')
195195
->variablePrototype()->end()
196196
->end()
@@ -537,7 +537,7 @@
537537
->thenInvalid(\sprintf('The model class "%%s" must extend %s.', Model::class))
538538
->end()
539539
->end()
540-
->stringNode('name')->defaultNull()->end()
540+
->stringNode('name')->isRequired()->end()
541541
->arrayNode('options')
542542
->variablePrototype()->end()
543543
->end()

src/ai-bundle/src/AiBundle.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,7 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
514514
}
515515

516516
$modelDefinition = new Definition($modelClass);
517-
if (null !== $modelName) {
518-
$modelDefinition->setArgument(0, $modelName);
519-
}
517+
$modelDefinition->setArgument(0, $modelName);
520518
if ([] !== $options) {
521519
$modelDefinition->setArgument(1, $options);
522520
}
@@ -1125,9 +1123,7 @@ private function processVectorizerConfig(string $name, array $config, ContainerB
11251123
}
11261124

11271125
$modelDefinition = (new Definition((string) $modelClass));
1128-
if (null !== $modelName) {
1129-
$modelDefinition->setArgument(0, $modelName);
1130-
}
1126+
$modelDefinition->setArgument(0, $modelName);
11311127
if ([] !== $options) {
11321128
$modelDefinition->setArgument(1, $options);
11331129
}

0 commit comments

Comments
 (0)