Skip to content

Commit 9e6912d

Browse files
committed
Use correct ManagerRepository for 7.x-demos
1 parent 045cdff commit 9e6912d

File tree

2 files changed

+20
-90
lines changed

2 files changed

+20
-90
lines changed
Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,20 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Repository\Attribute;
46

57
use App\Entity\Attribute\Secret;
68
use App\Repository\AbstractSecretRepository;
9+
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
710

8-
// Alias is needed because of test with both php 7.2, 7.4 and 8.0
9-
if (!interface_exists('\Doctrine\Common\Persistence\ManagerRegistry')) {
10-
class_alias(
11-
'\Doctrine\Persistence\ManagerRegistry',
12-
'\Doctrine\Common\Persistence\ManagerRegistry'
13-
);
14-
}
15-
16-
if (PHP_VERSION_ID >= 80000) {
17-
/**
18-
* @method Secret|null find($id, $lockMode = null, $lockVersion = null)
19-
* @method Secret|null findOneBy(array $criteria, array $orderBy = null)
20-
* @method Secret[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
21-
*/
22-
class SecretRepository extends AbstractSecretRepository
23-
{
24-
public function __construct(\Doctrine\Common\Persistence\ManagerRegistry $registry)
25-
{
26-
parent::__construct($registry, Secret::class);
27-
}
28-
}
29-
} else {
30-
/**
31-
* Dummy-repository for php < 8.0.
32-
*/
33-
class SecretRepository
11+
/**
12+
* @extends ServiceEntityRepository<Secret>
13+
*/
14+
class SecretRepository extends AbstractSecretRepository
15+
{
16+
public function __construct(\Doctrine\Persistence\ManagerRegistry $registry)
3417
{
35-
public function findAll()
36-
{
37-
return [];
38-
}
39-
40-
public function find($id, $lockMode = null, $lockVersion = null)
41-
{
42-
return null;
43-
}
44-
45-
public function findOneBy(array $criteria, ?array $orderBy = null)
46-
{
47-
return null;
48-
}
49-
50-
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
51-
{
52-
return [];
53-
}
18+
parent::__construct($registry, Secret::class);
5419
}
5520
}
Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,20 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Repository\Attribute;
46

57
use App\Entity\Attribute\Secret;
68
use App\Repository\AbstractSecretRepository;
9+
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
710

8-
// Alias is needed because of test with both php 7.2, 7.4 and 8.0
9-
if (!interface_exists('\Doctrine\Common\Persistence\ManagerRegistry')) {
10-
class_alias(
11-
'\Doctrine\Persistence\ManagerRegistry',
12-
'\Doctrine\Common\Persistence\ManagerRegistry'
13-
);
14-
}
15-
16-
if (PHP_VERSION_ID >= 80000) {
17-
/**
18-
* @method Secret|null find($id, $lockMode = null, $lockVersion = null)
19-
* @method Secret|null findOneBy(array $criteria, ?array $orderBy = null)
20-
* @method Secret[] findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
21-
*/
22-
class SecretRepository extends AbstractSecretRepository
23-
{
24-
public function __construct(\Doctrine\Common\Persistence\ManagerRegistry $registry)
25-
{
26-
parent::__construct($registry, Secret::class);
27-
}
28-
}
29-
} else {
30-
/**
31-
* Dummy-repository for php < 8.0.
32-
*/
33-
class SecretRepository
11+
/**
12+
* @extends ServiceEntityRepository<Secret>
13+
*/
14+
class SecretRepository extends AbstractSecretRepository
15+
{
16+
public function __construct(\Doctrine\Persistence\ManagerRegistry $registry)
3417
{
35-
public function findAll()
36-
{
37-
return [];
38-
}
39-
40-
public function find($id, $lockMode = null, $lockVersion = null)
41-
{
42-
return null;
43-
}
44-
45-
public function findOneBy(array $criteria, ?array $orderBy = null)
46-
{
47-
return null;
48-
}
49-
50-
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
51-
{
52-
return [];
53-
}
18+
parent::__construct($registry, Secret::class);
5419
}
5520
}

0 commit comments

Comments
 (0)