Skip to content

[make:entity] doctine/persistence v4 support, drop xml entity config support #1677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Doctrine/DoctrineHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Doctrine\Persistence\Mapping\MappingException as PersistenceMappingException;
use Doctrine\Persistence\Mapping\StaticReflectionService;
use Symfony\Bundle\MakerBundle\Util\ClassNameDetails;
use Symfony\Component\Uid\Ulid;
use Symfony\Component\Uid\Uuid;
Expand Down
62 changes: 62 additions & 0 deletions src/Doctrine/StaticReflectionService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

/*
* This file is part of the Symfony MakerBundle package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\MakerBundle\Doctrine;

use Doctrine\Persistence\Mapping\ReflectionService;

/**
* @internal replacing removed Doctrine\Persistence\Mapping\StaticReflectionService
*/
final class StaticReflectionService implements ReflectionService
{
public function getParentClasses($class): array
{
return [];
}

public function getClassShortName($class): string
{
$nsSeparatorLastPosition = strrpos($class, '\\');

if (false !== $nsSeparatorLastPosition) {
$class = substr($class, $nsSeparatorLastPosition + 1);
}

return $class;
}

public function getClassNamespace($class): string
{
$namespace = '';

if (str_contains($class, '\\')) {
$namespace = strrev(substr(strrev($class), (int) strpos(strrev($class), '\\') + 1));
}

return $namespace;
}

public function getClass($class): \ReflectionClass
{
return new \ReflectionClass($class);
}

public function getAccessibleProperty($class, $property): ?\ReflectionProperty
{
return null;
}

public function hasPublicMethod($class, $method): bool
{
return true;
}
}
13 changes: 0 additions & 13 deletions tests/Doctrine/EntityRegeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,6 @@ public function getRegenerateEntitiesTests(): \Generator
];
}

public function testXmlRegeneration(): void
{
$kernel = new TestXmlEntityRegeneratorKernel('dev', true);
$this->doTestRegeneration(
__DIR__.'/fixtures/xml_source_project',
$kernel,
'Symfony\Bundle\MakerBundle\Tests\tmp\current_project_xml\src\Entity',
'expected_xml',
false,
'current_project_xml'
);
}

private function doTestRegeneration(string $sourceDir, Kernel $kernel, string $namespace, string $expectedDirName, bool $overwrite, string $targetDirName): void
{
$fs = new Filesystem();
Expand Down
27 changes: 0 additions & 27 deletions tests/Doctrine/fixtures/expected_xml/src/Entity/UserAvatar.php

This file was deleted.

71 changes: 0 additions & 71 deletions tests/Doctrine/fixtures/expected_xml/src/Entity/UserXml.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Doctrine/fixtures/expected_xml/src/Entity/XOther.php

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions tests/Doctrine/fixtures/xml_source_project/src/Entity/UserXml.php

This file was deleted.

Loading