Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DoctrineBridge] Undeprecate DoctrineExtractor::getTypes() #56848

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
May 21, 2024
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/Symfony/Bridge/Doctrine/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ CHANGELOG
7.1
---

* Deprecate the `DoctrineExtractor::getTypes()` method, use `DoctrineExtractor::getType()` instead
* Allow `EntityValueResolver` to return a list of entities
* Add support for auto-closing idle connections
* Allow validating every class against `UniqueEntity` constraint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,8 @@ public function getType(string $class, string $property, array $context = []): ?
};
}

/**
* @deprecated since Symfony 7.1, use "getType" instead
*/
public function getTypes(string $class, string $property, array $context = []): ?array
{
trigger_deprecation('symfony/property-info', '7.1', 'The "%s()" method is deprecated, use "%s::getType()" instead.', __METHOD__, self::class);

if (null === $metadata = $this->getMetadata($class)) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,13 @@ public function testTestGetPropertiesWithEmbedded()
}

/**
* @group legacy
*
* @dataProvider legacyTypesProvider
*/
public function testExtractLegacy(string $property, ?array $type = null)
{
$this->assertEquals($type, $this->createExtractor()->getTypes(DoctrineDummy::class, $property, []));
}

/**
* @group legacy
*/
public function testExtractWithEmbeddedLegacy()
{
$expectedTypes = [new LegacyType(
Expand All @@ -137,9 +132,6 @@ public function testExtractWithEmbeddedLegacy()
$this->assertEquals($expectedTypes, $actualTypes);
}

/**
* @group legacy
*/
public function testExtractEnumLegacy()
{
$this->assertEquals([new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, EnumString::class)], $this->createExtractor()->getTypes(DoctrineEnum::class, 'enumString', []));
Expand All @@ -149,9 +141,6 @@ public function testExtractEnumLegacy()
$this->assertNull($this->createExtractor()->getTypes(DoctrineEnum::class, 'enumCustom', []));
}

/**
* @group legacy
*/
public static function legacyTypesProvider(): array
{
// DBAL 4 has a special fallback strategy for BINGINT (int -> string)
Expand Down Expand Up @@ -251,9 +240,6 @@ public function testGetPropertiesCatchException()
$this->assertNull($this->createExtractor()->getProperties('Not\Exist'));
}

/**
* @group legacy
*/
public function testGetTypesCatchExceptionLegacy()
{
$this->assertNull($this->createExtractor()->getTypes('Not\Exist', 'baz'));
Expand Down
Loading