Skip to content

Commit

Permalink
make use of doctrine-bundle 2.1 + and EventSubscriberInterface (#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Aug 9, 2021
1 parent 0eb2d3f commit dcb5629
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -16,6 +16,7 @@
"doctrine/persistence": "^2.0",
"doctrine/dbal": "^2.9",
"doctrine/orm": "^2.8",
"doctrine/doctrine-bundle": "^2.4",
"symfony/cache": "^4.4|^5.2",
"symfony/dependency-injection": "^4.4|^5.2",
"symfony/http-kernel": "^4.4|^5.2",
Expand All @@ -33,7 +34,6 @@
"ext-pdo_pgsql": "*",
"psr/log": "^1.1",
"doctrine/annotations": "^1.12",
"doctrine/doctrine-bundle": "^2.2",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^0.12.84",
"phpunit/phpunit": "^9.5",
Expand Down
10 changes: 0 additions & 10 deletions src/Bundle/DependencyInjection/DoctrineBehaviorsExtension.php
Expand Up @@ -4,29 +4,19 @@

namespace Knp\DoctrineBehaviors\Bundle\DependencyInjection;

use Doctrine\Common\EventSubscriber;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;

final class DoctrineBehaviorsExtension extends Extension
{
/**
* @var string
*/
private const DOCTRINE_EVENT_SUBSCRIBER_TAG = 'doctrine.event_subscriber';

/**
* @param string[] $configs
*/
public function load(array $configs, ContainerBuilder $containerBuilder): void
{
$phpFileLoader = new PhpFileLoader($containerBuilder, new FileLocator(__DIR__ . '/../../../config'));
$phpFileLoader->load('services.php');

// @see https://github.com/doctrine/DoctrineBundle/issues/674
$containerBuilder->registerForAutoconfiguration(EventSubscriber::class)
->addTag(self::DOCTRINE_EVENT_SUBSCRIBER_TAG);
}
}
4 changes: 2 additions & 2 deletions src/EventSubscriber/BlameableEventSubscriber.php
Expand Up @@ -4,7 +4,7 @@

namespace Knp\DoctrineBehaviors\EventSubscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
Expand All @@ -14,7 +14,7 @@
use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
use Knp\DoctrineBehaviors\Contract\Provider\UserProviderInterface;

final class BlameableEventSubscriber implements EventSubscriber
final class BlameableEventSubscriber implements EventSubscriberInterface
{
/**
* @var string
Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/LoggableEventSubscriber.php
Expand Up @@ -4,14 +4,14 @@

namespace Knp\DoctrineBehaviors\EventSubscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
use Knp\DoctrineBehaviors\Contract\Entity\LoggableInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;

final class LoggableEventSubscriber implements EventSubscriber
final class LoggableEventSubscriber implements EventSubscriberInterface
{
/**
* @var LoggerInterface
Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/SluggableEventSubscriber.php
Expand Up @@ -4,7 +4,7 @@

namespace Knp\DoctrineBehaviors\EventSubscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
Expand All @@ -13,7 +13,7 @@
use Knp\DoctrineBehaviors\Contract\Entity\SluggableInterface;
use Knp\DoctrineBehaviors\Repository\DefaultSluggableRepository;

final class SluggableEventSubscriber implements EventSubscriber
final class SluggableEventSubscriber implements EventSubscriberInterface
{
/**
* @var string
Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/SoftDeletableEventSubscriber.php
Expand Up @@ -4,13 +4,13 @@

namespace Knp\DoctrineBehaviors\EventSubscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Event\OnFlushEventArgs;
use Doctrine\ORM\Events;
use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;

final class SoftDeletableEventSubscriber implements EventSubscriber
final class SoftDeletableEventSubscriber implements EventSubscriberInterface
{
/**
* @var string
Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/TimestampableEventSubscriber.php
Expand Up @@ -4,12 +4,12 @@

namespace Knp\DoctrineBehaviors\EventSubscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;
use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;

final class TimestampableEventSubscriber implements EventSubscriber
final class TimestampableEventSubscriber implements EventSubscriberInterface
{
/**
* @var string
Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/TranslatableEventSubscriber.php
Expand Up @@ -4,7 +4,7 @@

namespace Knp\DoctrineBehaviors\EventSubscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;
Expand All @@ -13,7 +13,7 @@
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
use Knp\DoctrineBehaviors\Contract\Provider\LocaleProviderInterface;

final class TranslatableEventSubscriber implements EventSubscriber
final class TranslatableEventSubscriber implements EventSubscriberInterface
{
/**
* @var string
Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/TreeEventSubscriber.php
Expand Up @@ -4,12 +4,12 @@

namespace Knp\DoctrineBehaviors\EventSubscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;
use Knp\DoctrineBehaviors\Contract\Entity\TreeNodeInterface;

final class TreeEventSubscriber implements EventSubscriber
final class TreeEventSubscriber implements EventSubscriberInterface
{
public function loadClassMetadata(LoadClassMetadataEventArgs $loadClassMetadataEventArgs): void
{
Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/UuidableEventSubscriber.php
Expand Up @@ -4,13 +4,13 @@

namespace Knp\DoctrineBehaviors\EventSubscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;
use Knp\DoctrineBehaviors\Contract\Entity\UuidableInterface;

final class UuidableEventSubscriber implements EventSubscriber
final class UuidableEventSubscriber implements EventSubscriberInterface
{
public function loadClassMetadata(LoadClassMetadataEventArgs $loadClassMetadataEventArgs): void
{
Expand Down

0 comments on commit dcb5629

Please sign in to comment.