Skip to content

Commit 7b7f069

Browse files
committed
[make:entity] doctine/persistence v4 support, drop xml entity config support
1 parent 2b80d6b commit 7b7f069

File tree

16 files changed

+62
-358
lines changed

16 files changed

+62
-358
lines changed

src/Doctrine/DoctrineHelper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
2525
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
2626
use Doctrine\Persistence\Mapping\MappingException as PersistenceMappingException;
27-
use Doctrine\Persistence\Mapping\StaticReflectionService;
2827
use Symfony\Bundle\MakerBundle\Util\ClassNameDetails;
2928
use Symfony\Component\Uid\Ulid;
3029
use Symfony\Component\Uid\Uuid;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony MakerBundle package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\MakerBundle\Doctrine;
13+
14+
use Doctrine\Persistence\Mapping\ReflectionService;
15+
16+
/**
17+
* @internal replacing removed Doctrine\Persistence\Mapping\StaticReflectionService
18+
*/
19+
final class StaticReflectionService implements ReflectionService
20+
{
21+
public function getParentClasses($class): array
22+
{
23+
return [];
24+
}
25+
26+
public function getClassShortName($class): string
27+
{
28+
$nsSeparatorLastPosition = strrpos($class, '\\');
29+
30+
if (false !== $nsSeparatorLastPosition) {
31+
$class = substr($class, $nsSeparatorLastPosition + 1);
32+
}
33+
34+
return $class;
35+
}
36+
37+
public function getClassNamespace($class): string
38+
{
39+
$namespace = '';
40+
41+
if (str_contains($class, '\\')) {
42+
$namespace = strrev(substr(strrev($class), (int) strpos(strrev($class), '\\') + 1));
43+
}
44+
45+
return $namespace;
46+
}
47+
48+
public function getClass($class): \ReflectionClass
49+
{
50+
return new \ReflectionClass($class);
51+
}
52+
53+
public function getAccessibleProperty($class, $property): ?\ReflectionProperty
54+
{
55+
return null;
56+
}
57+
58+
public function hasPublicMethod($class, $method): bool
59+
{
60+
return true;
61+
}
62+
}

tests/Doctrine/EntityRegeneratorTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,6 @@ public function getRegenerateEntitiesTests(): \Generator
6363
];
6464
}
6565

66-
public function testXmlRegeneration(): void
67-
{
68-
$kernel = new TestXmlEntityRegeneratorKernel('dev', true);
69-
$this->doTestRegeneration(
70-
__DIR__.'/fixtures/xml_source_project',
71-
$kernel,
72-
'Symfony\Bundle\MakerBundle\Tests\tmp\current_project_xml\src\Entity',
73-
'expected_xml',
74-
false,
75-
'current_project_xml'
76-
);
77-
}
78-
7966
private function doTestRegeneration(string $sourceDir, Kernel $kernel, string $namespace, string $expectedDirName, bool $overwrite, string $targetDirName): void
8067
{
8168
$fs = new Filesystem();

tests/Doctrine/fixtures/expected_xml/src/Entity/UserAvatar.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

tests/Doctrine/fixtures/expected_xml/src/Entity/UserXml.php

Lines changed: 0 additions & 71 deletions
This file was deleted.

tests/Doctrine/fixtures/expected_xml/src/Entity/XOther.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

tests/Doctrine/fixtures/xml_source_project/config/doctrine/UserAvatar.orm.xml

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/Doctrine/fixtures/xml_source_project/config/doctrine/UserXml.orm.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/Doctrine/fixtures/xml_source_project/config/doctrine/XOther.orm.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/Doctrine/fixtures/xml_source_project/src/Entity/UserXml.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)