Skip to content

Commit

Permalink
Add support for Twig and Doctrine extensions 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Aug 5, 2022
1 parent f4a653e commit cd828d1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"doctrine/persistence": "^2.1 || ^3.0",
"sonata-project/admin-bundle": "^4.15",
"sonata-project/block-bundle": "^4.16",
"sonata-project/doctrine-extensions": "^1.8",
"sonata-project/doctrine-extensions": "^1.8 || ^2.0",
"sonata-project/doctrine-orm-admin-bundle": "^4.0",
"sonata-project/form-extensions": "^1.4",
"sonata-project/seo-bundle": "^3.0",
"sonata-project/twig-extensions": "^1.3",
"sonata-project/twig-extensions": "^1.3 || ^2.0",
"symfony-cmf/routing-bundle": "^2.1 || ^3.0",
"symfony/config": "^4.4 || ^5.4 || ^6.0",
"symfony/console": "^4.4 || ^5.4 || ^6.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Command/CloneSiteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
}

$this->pageManager->save($page, true);
$this->pageManager->save($page);
}

$output->writeln('Fixing block parents');
Expand All @@ -183,7 +183,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$block->setParent(null);
}

$this->blockManager->save($block, true);
$this->blockManager->save($block);
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/Entity/PageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ public function fixUrl(PageInterface $page): void
}
}

public function save($entity, $andFlush = true)
/**
* TODO: Add tyephinting once sonata-project/doctrine-extensions < 2 is dropped.
*/
public function save($entity, $andFlush = true): void
{
if (!$entity->isHybrid()) {
$this->fixUrl($entity);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/CreateBlockContainerCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testCreateBlock(): void

$page = new Page();
$pageManager->method('findBy')->with(['templateCode' => 'foo'])->willReturn([$page]);
$pageManager->method('save')->with($page)->willReturn($page);
$pageManager->method('save')->with($page);

$command = new CreateBlockContainerCommand($pageManager, $blockInteractor);

Expand Down
2 changes: 1 addition & 1 deletion tests/Route/RoutePageGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private function getRoutePageGenerator(): RoutePageGenerator
$pageManager->expects(static::atLeastOnce())
->method('findOneBy')
->willReturnMap([
[['routeName' => 'test_hybrid_page_with_bad_host', 'site' => 1], null, $hybridPageWithBadHost],
[['routeName' => 'test_hybrid_page_with_bad_host', 'site' => 1], $hybridPageWithBadHost],
]);

$pageManager
Expand Down

0 comments on commit cd828d1

Please sign in to comment.