Skip to content

Commit

Permalink
Fix error caused by non-existing gedmo doctrine mapping directory (#26)
Browse files Browse the repository at this point in the history
* Fix error caused by non-existing gedmo doctrine mapping directory

* Fix phpstan
  • Loading branch information
plozmun authored and alexander-schranz committed Mar 4, 2021
1 parent 3170aa0 commit 9818b4d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions DependencyInjection/CompilerPass/ImageFormatCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ protected function getFiles(ContainerBuilder $container)
{
/** @var ThemeRepositoryInterface $themeRepository */
$themeRepository = $container->get('sylius.repository.theme');

/** @var array<class-string> $bundles */
$bundles = $container->getParameter('kernel.bundles');

$configPath = 'config/image-formats.xml';

$files = [];
Expand Down
6 changes: 5 additions & 1 deletion DependencyInjection/SuluThemeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class SuluThemeExtension extends Extension
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load(sprintf('%s.xml', $container->getParameter('sulu.context')));

/** @var string $context */
$context = $container->getParameter('sulu.context');

$loader->load(sprintf('%s.xml', $context));
}
}
12 changes: 12 additions & 0 deletions Tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,16 @@ public function registerContainerConfiguration(LoaderInterface $loader): void

$loader->load(__DIR__ . '/config/config_' . $this->getContext() . '.yaml');
}

protected function getKernelParameters()
{
$parameters = parent::getKernelParameters();

$reflection = new \ReflectionClass(\Gedmo\Exception::class);
$gedmoDirectory = \dirname($reflection->getFileName());

$parameters['gedmo_directory'] = $gedmoDirectory;

return $parameters;
}
}
2 changes: 1 addition & 1 deletion Tests/Application/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ doctrine:
gedmo_tree:
type: xml
prefix: Gedmo\Tree\Entity
dir: "%kernel.project_dir%/../../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
dir: "%gedmo_directory%/Tree/Entity"
alias: GedmoTree
is_bundle: false

Expand Down

0 comments on commit 9818b4d

Please sign in to comment.