Skip to content

Commit

Permalink
also fix other calls
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher authored and VincentLanglet committed Apr 30, 2021
1 parent eabc5a4 commit c6f416e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public function applyDefaults(ContainerBuilder $container, $serviceId, array $at

$method = $this->generateSetterMethodName($attr);

if (isset($overwriteAdminConfiguration[$attr]) || !$definition->hasMethodCall($method)) {
if (!$definition->hasMethodCall($method)) {
$args = [new Reference($overwriteAdminConfiguration[$attr] ?? $addServiceId)];
if ('translator' === $attr) {
$args[] = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Symfony\Component\DependencyInjection\Compiler\ResolveEnvPlaceholdersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

/**
* @author Tiago Garcia
Expand Down Expand Up @@ -213,6 +214,12 @@ public function testProcessResultingConfig(): void
[[]]
);

$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
'sonata_news_admin',
'setModelManager',
[new Reference('my.model.manager')]
);

$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
'sonata_article_admin',
'setFormTheme',
Expand Down Expand Up @@ -668,7 +675,8 @@ private function setUpContainer(): void
->setPublic(true)
->setClass(MockAdmin::class)
->setArguments(['', News::class, CRUDController::class])
->addTag('sonata.admin', ['group' => 'sonata_group_two', 'label' => '5 Entry', 'manager_type' => 'orm']);
->addTag('sonata.admin', ['group' => 'sonata_group_two', 'label' => '5 Entry', 'manager_type' => 'orm'])
->addMethodCall('setModelManager', [new Reference('my.model.manager')]);
$this->container
->register('sonata_post_admin')
->setClass(MockAdmin::class)
Expand Down

0 comments on commit c6f416e

Please sign in to comment.