Compare commits

..

2 Commits

Author SHA1 Message Date
Tomas Votruba
1c323223b2 Updated Rector to commit 068799f59b289bef06b9c1f384df4301b19e726e
068799f59b [Performance] Early skip func call name on ClassRenamer (#5837)
2024-04-21 12:45:15 +00:00
Tomas Votruba
655c2aa498 Updated Rector to commit 068799f59b289bef06b9c1f384df4301b19e726e
068799f59b [Performance] Early skip func call name on ClassRenamer (#5837)
2024-04-21 12:39:04 +00:00
7 changed files with 30 additions and 12 deletions

View File

@ -1679,12 +1679,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git", "url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
"reference": "b3da143634de79b24a266afc07401cfe75a2c49c" "reference": "9e0a97b087071637e35eda5c7596704ee137a082"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/b3da143634de79b24a266afc07401cfe75a2c49c", "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/9e0a97b087071637e35eda5c7596704ee137a082",
"reference": "b3da143634de79b24a266afc07401cfe75a2c49c", "reference": "9e0a97b087071637e35eda5c7596704ee137a082",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1709,7 +1709,7 @@
"tomasvotruba\/unused-public": "^0.3", "tomasvotruba\/unused-public": "^0.3",
"tracy\/tracy": "^2.10" "tracy\/tracy": "^2.10"
}, },
"time": "2024-03-22T00:11:46+00:00", "time": "2024-04-21T12:41:39+00:00",
"default-branch": true, "default-branch": true,
"type": "rector-extension", "type": "rector-extension",
"extra": { "extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/ */
final class GeneratedConfig final class GeneratedConfig
{ {
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main b3da143'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 05e44cf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main e8af39b'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main b8126e8')); public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 9e0a97b'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 05e44cf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main e8af39b'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main b8126e8'));
private function __construct() private function __construct()
{ {
} }

View File

@ -37,11 +37,19 @@ final class TableClassAttributeTransformer implements ClassAttributeTransformerI
$args[] = AttributeFactory::createNamedArg(new String_($table), 'name'); $args[] = AttributeFactory::createNamedArg(new String_($table), 'name');
} }
$class->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args); $class->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
$uniqueConstraints = $classMapping['uniqueConstraints'] ?? []; $this->addIndexes($classMapping['indexes'] ?? [], $class, MappingClass::INDEX);
foreach ($uniqueConstraints as $name => $uniqueConstraint) { $this->addIndexes($classMapping['uniqueConstraints'] ?? [], $class, MappingClass::UNIQUE_CONSTRAINT);
$uniqueConstraint = \array_merge(['name' => $name], $uniqueConstraint); }
$args = $this->nodeFactory->createArgs($uniqueConstraint); /**
$class->attrGroups[] = AttributeFactory::createGroup(MappingClass::UNIQUE_CONSTRAINT, $args); * @param array<string, array<string, mixed>> $mapping
* @param MappingClass::* $attribute
*/
private function addIndexes(array $mapping, Class_ $class, string $attribute) : void
{
foreach ($mapping as $name => $values) {
$values = \array_merge(['name' => $name], $values);
$args = $this->nodeFactory->createArgs($values);
$class->attrGroups[] = AttributeFactory::createGroup($attribute, $args);
} }
} }
public function getClassName() : string public function getClassName() : string

View File

@ -31,6 +31,12 @@ final class JoinColumnAttributeTransformer implements PropertyAttributeTransform
if (!\is_array($manyToOnePropertyMapping)) { if (!\is_array($manyToOnePropertyMapping)) {
return; return;
} }
$singleJoinColumn = $manyToOnePropertyMapping['joinColumn'] ?? null;
if (\is_array($singleJoinColumn)) {
$name = $singleJoinColumn['name'];
unset($singleJoinColumn['name']);
$manyToOnePropertyMapping['joinColumns'][$name] = $singleJoinColumn;
}
$joinColumns = $manyToOnePropertyMapping['joinColumns'] ?? null; $joinColumns = $manyToOnePropertyMapping['joinColumns'] ?? null;
if (!\is_array($joinColumns)) { if (!\is_array($joinColumns)) {
return; return;

View File

@ -33,7 +33,7 @@ final class ManyToOneAttributeTransformer implements PropertyAttributeTransforme
return; return;
} }
// handled by another mapper // handled by another mapper
unset($manyToOneMapping['joinColumns']); unset($manyToOneMapping['joinColumn'], $manyToOneMapping['joinColumns']);
// non existing // non existing
unset($manyToOneMapping['nullable']); unset($manyToOneMapping['nullable']);
$args = $this->nodeFactory->createArgs($manyToOneMapping); $args = $this->nodeFactory->createArgs($manyToOneMapping);

View File

@ -53,6 +53,10 @@ final class MappingClass
* @var string * @var string
*/ */
public const GENERATED_VALUE = 'Doctrine\\ORM\\Mapping\\GeneratedValue'; public const GENERATED_VALUE = 'Doctrine\\ORM\\Mapping\\GeneratedValue';
/**
* @var string
*/
public const INDEX = 'Doctrine\\ORM\\Mapping\\Index';
/** /**
* @var string * @var string
*/ */