Skip to content

Commit

Permalink
Override Bundle::getPath()
Browse files Browse the repository at this point in the history
This is required when the bundle class is not at the root path of the
bundle, which is the case since #1767
  • Loading branch information
greg0ire committed Mar 15, 2024
1 parent fa3e8e3 commit 4eacd97
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/DoctrineBundle.php
Expand Up @@ -16,6 +16,7 @@
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Proxy\Autoloader;
use Doctrine\ORM\Proxy\DefaultProxyClassNameResolver;
use ReflectionObject;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\DoctrineValidationPass;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterUidTypePass;
Expand All @@ -30,6 +31,7 @@
use function assert;
use function class_exists;
use function clearstatcache;
use function dirname;
use function spl_autoload_unregister;

/** @final since 2.9 */
Expand Down Expand Up @@ -168,4 +170,14 @@ public function shutdown()
public function registerCommands(Application $application)
{
}

public function getPath(): string
{
if (! isset($this->path)) {

Check failure on line 176 in src/DoctrineBundle.php

View workflow job for this annotation

GitHub Actions / Static Analysis with Psalm

RedundantPropertyInitializationCheck

src/DoctrineBundle.php:176:15: RedundantPropertyInitializationCheck: Property $this->path with type string should already be set in the constructor (see https://psalm.dev/261)
$reflected = new ReflectionObject($this);
$this->path = dirname($reflected->getFileName());
}

return $this->path;
}
}

0 comments on commit 4eacd97

Please sign in to comment.