Skip to content

Commit 889f450

Browse files
committed
Change the EntityManger to ModelManger adapter into a trait
This means its easy to integrate into an existing repository
1 parent ae9faa3 commit 889f450

8 files changed

+24
-9
lines changed

src/Entity/AccessTokenRepository.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
namespace AuthBucket\Bundle\OAuth2Bundle\Entity;
1313

1414
use AuthBucket\OAuth2\Model\AccessTokenManagerInterface;
15+
use Doctrine\ORM\EntityRepository;
1516

1617
/**
1718
* AccessTokenRepository.
1819
*
1920
* This class was generated by the Doctrine ORM. Add your own custom
2021
* repository methods below.
2122
*/
22-
class AccessTokenRepository extends AbstractEntityRepository implements AccessTokenManagerInterface
23+
class AccessTokenRepository extends EntityRepository implements AccessTokenManagerInterface
2324
{
25+
use ModelManagerEntityRepository;
2426
}

src/Entity/AuthorizeRepository.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
namespace AuthBucket\Bundle\OAuth2Bundle\Entity;
1313

1414
use AuthBucket\OAuth2\Model\AuthorizeManagerInterface;
15+
use Doctrine\ORM\EntityRepository;
1516

1617
/**
1718
* AuthorizeRepository.
1819
*
1920
* This class was generated by the Doctrine ORM. Add your own custom
2021
* repository methods below.
2122
*/
22-
class AuthorizeRepository extends AbstractEntityRepository implements AuthorizeManagerInterface
23+
class AuthorizeRepository extends EntityRepository implements AuthorizeManagerInterface
2324
{
25+
use ModelManagerEntityRepository;
2426
}

src/Entity/ClientRepository.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
namespace AuthBucket\Bundle\OAuth2Bundle\Entity;
1313

1414
use AuthBucket\OAuth2\Model\ClientManagerInterface;
15+
use Doctrine\ORM\EntityRepository;
1516

1617
/**
1718
* ClientRepository.
1819
*
1920
* This class was generated by the Doctrine ORM. Add your own custom
2021
* repository methods below.
2122
*/
22-
class ClientRepository extends AbstractEntityRepository implements ClientManagerInterface
23+
class ClientRepository extends EntityRepository implements ClientManagerInterface
2324
{
25+
use ModelManagerEntityRepository;
2426
}

src/Entity/CodeRepository.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
namespace AuthBucket\Bundle\OAuth2Bundle\Entity;
1313

1414
use AuthBucket\OAuth2\Model\CodeManagerInterface;
15+
use Doctrine\ORM\EntityRepository;
1516

1617
/**
1718
* CodeRepository.
1819
*
1920
* This class was generated by the Doctrine ORM. Add your own custom
2021
* repository methods below.
2122
*/
22-
class CodeRepository extends AbstractEntityRepository implements CodeManagerInterface
23+
class CodeRepository extends EntityRepository implements CodeManagerInterface
2324
{
25+
use ModelManagerEntityRepository;
2426
}

src/Entity/AbstractEntityRepository.php src/Entity/ModelManagerEntityRepository.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* This class was generated by the Doctrine ORM. Add your own custom
2222
* repository methods below.
2323
*/
24-
class AbstractEntityRepository extends EntityRepository implements ModelManagerInterface
24+
trait ModelManagerEntityRepository
2525
{
2626
public function createModel(ModelInterface $model)
2727
{

src/Entity/RefreshTokenRepository.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
namespace AuthBucket\Bundle\OAuth2Bundle\Entity;
1313

1414
use AuthBucket\OAuth2\Model\RefreshTokenManagerInterface;
15+
use Doctrine\ORM\EntityRepository;
1516

1617
/**
1718
* RefreshTokenRepository.
1819
*
1920
* This class was generated by the Doctrine ORM. Add your own custom
2021
* repository methods below.
2122
*/
22-
class RefreshTokenRepository extends AbstractEntityRepository implements RefreshTokenManagerInterface
23+
class RefreshTokenRepository extends EntityRepository implements RefreshTokenManagerInterface
2324
{
25+
use ModelManagerEntityRepository;
2426
}

src/Entity/ScopeRepository.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
namespace AuthBucket\Bundle\OAuth2Bundle\Entity;
1313

1414
use AuthBucket\OAuth2\Model\ScopeManagerInterface;
15+
use Doctrine\ORM\EntityRepository;
1516

1617
/**
1718
* ScopeRepository.
1819
*
1920
* This class was generated by the Doctrine ORM. Add your own custom
2021
* repository methods below.
2122
*/
22-
class ScopeRepository extends AbstractEntityRepository implements ScopeManagerInterface
23+
class ScopeRepository extends EntityRepository implements ScopeManagerInterface
2324
{
25+
use ModelManagerEntityRepository;
2426
}

tests/TestBundle/Entity/UserRepository.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
namespace AuthBucket\Bundle\OAuth2Bundle\Tests\TestBundle\Entity;
1313

14-
use AuthBucket\Bundle\OAuth2Bundle\Entity\AbstractEntityRepository;
14+
use AuthBucket\Bundle\OAuth2Bundle\Entity\ModelManagerEntityRepository;
15+
use Doctrine\ORM\EntityRepository;
1516
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
1617
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
1718
use Symfony\Component\Security\Core\User\UserInterface;
@@ -22,8 +23,10 @@
2223
* This class was generated by the Doctrine ORM. Add your own custom
2324
* repository methods below.
2425
*/
25-
class UserRepository extends AbstractEntityRepository implements UserLoaderInterface
26+
class UserRepository extends EntityRepository implements UserLoaderInterface
2627
{
28+
use ModelManagerEntityRepository;
29+
2730
public function createUser()
2831
{
2932
$class = $this->getClassName();

0 commit comments

Comments
 (0)