Skip to content

Commit

Permalink
Merge pull request #42 from pitpit/bugfix/doctrine.orm.entity_manager…
Browse files Browse the repository at this point in the history
…-non-existent

fixed bug when running `app/console clear:cache`
  • Loading branch information
markitosgv committed Apr 12, 2016
2 parents 3ce2929 + 154c391 commit 22c6ba0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
/**
* CustomUserProviderCompilerPass.
*/
final class CustomEntityManagerCompilerPass implements CompilerPassInterface
final class EntityManagerCompilerPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
$customEntityManagerId = $container->getParameter('gesdinet.jwtrefreshtoken.entity_manager.id');
if (!$customEntityManagerId) {
$entityManagerId = $container->getParameter('gesdinet.jwtrefreshtoken.entity_manager.id');
if (!$entityManagerId) {
return;
}

//replace the base alias
$container->setAlias('gesdinet.jwtrefreshtoken.entity_manager', $customEntityManagerId);
$container->setAlias('gesdinet.jwtrefreshtoken.entity_manager', $entityManagerId);
}
}
4 changes: 2 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public function getConfigTreeBuilder()
->info('Set another refresh token entity to use instead of default one (Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken)')
->end()
->scalarNode('entity_manager')
->defaultNull()
->info('Set another entity manager instead of default one (doctrine.orm.entity_manager)')
->defaultValue('doctrine.orm.entity_manager')
->info('Set entity manager to use (default: doctrine.orm.entity_manager)')
->end()
->end();

Expand Down
4 changes: 2 additions & 2 deletions GesdinetJWTRefreshTokenBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Gesdinet\JWTRefreshTokenBundle;

use Gesdinet\JWTRefreshTokenBundle\DependencyInjection\Compiler\CustomUserProviderCompilerPass;
use Gesdinet\JWTRefreshTokenBundle\DependencyInjection\Compiler\CustomEntityManagerCompilerPass;
use Gesdinet\JWTRefreshTokenBundle\DependencyInjection\Compiler\EntityManagerCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

Expand All @@ -14,6 +14,6 @@ public function build(ContainerBuilder $container)
parent::build($container);

$container->addCompilerPass(new CustomUserProviderCompilerPass());
$container->addCompilerPass(new CustomEntityManagerCompilerPass());
$container->addCompilerPass(new EntityManagerCompilerPass());
}
}
3 changes: 0 additions & 3 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ parameters:
gesdinet.jwtrefreshtoken.refresh_token.class: Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken

services:
gesdinet.jwtrefreshtoken.entity_manager:
alias: '@doctrine.orm.entity_manager'

gesdinet.jwtrefreshtoken.send_token:
class: Gesdinet\JWTRefreshTokenBundle\EventListener\AttachRefreshTokenOnSuccessListener
arguments: [ "@gesdinet.jwtrefreshtoken.refresh_token_manager", "%gesdinet_jwt_refresh_token.ttl%", "@validator" ]
Expand Down

0 comments on commit 22c6ba0

Please sign in to comment.