Skip to content

Commit 7754d0b

Browse files
committed
rename attribute
1 parent 8113f71 commit 7754d0b

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

docs/en/dbal-type.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
DBAL Types
22
==========
33

4-
Custom DBAL types can be registered using the ``AsDatabaseType`` attribute. This
4+
Custom DBAL types can be registered using the ``AsDbalType`` attribute. This
55
attribute allows you to define a name for your custom type directly in the class
66
definition. If the name is not provided, the class name will be used as the default.
77

88
To register a custom DBAL type, create a class that extends
9-
``Doctrine\DBAL\Types\Type`` and add the ``#[AsDatabaseType]`` attribute to it:
9+
``Doctrine\DBAL\Types\Type`` and add the ``#[AsDbalType]`` attribute to it:
1010

1111
.. code-block:: php
1212
1313
namespace App\Doctrine\Type;
1414
15-
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDatabaseType;
15+
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDbalType;
1616
use Doctrine\DBAL\Platforms\AbstractPlatform;
1717
use Doctrine\DBAL\Types\Type;
1818
19-
#[AsDatabaseType(name: 'money')]
19+
#[AsDbalType(name: 'money')]
2020
class MoneyType extends Type
2121
{
2222
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
@@ -35,7 +35,7 @@ To register a custom DBAL type, create a class that extends
3535
}
3636
}
3737
38-
When using the ``AsDatabaseType`` attribute, the type will be automatically
38+
When using the ``AsDbalType`` attribute, the type will be automatically
3939
registered with Doctrine.
4040

4141
Manual Registration
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Attribute;
88

99
#[Attribute(Attribute::TARGET_CLASS)]
10-
final readonly class AsDatabaseType
10+
final readonly class AsDbalType
1111
{
1212
public function __construct(public string|null $name = null)
1313
{

src/DependencyInjection/Compiler/RegisterDbalTypePass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler;
66

7-
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDatabaseType;
7+
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDbalType;
88
use Doctrine\DBAL\Types\Type;
99
use ReflectionClass;
1010
use Symfony\Component\DependencyInjection\ChildDefinition;
@@ -26,7 +26,7 @@ final class RegisterDbalTypePass implements CompilerPassInterface
2626
*
2727
* @template T of ReflectionClass
2828
*/
29-
public static function autoconfigureFromAttribute(ChildDefinition $definition, AsDatabaseType $type, ReflectionClass $reflector): void
29+
public static function autoconfigureFromAttribute(ChildDefinition $definition, AsDbalType $type, ReflectionClass $reflector): void
3030
{
3131
$attributes = [
3232
'type_name' => $type->name ?? $reflector->name,

src/DependencyInjection/DoctrineExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Doctrine\Bundle\DoctrineBundle\DependencyInjection;
66

7-
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDatabaseType;
7+
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDbalType;
88
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener;
99
use Doctrine\Bundle\DoctrineBundle\Attribute\AsEntityListener;
1010
use Doctrine\Bundle\DoctrineBundle\Attribute\AsMiddleware;
@@ -553,7 +553,7 @@ private function dbalLoad(array $config, ContainerBuilder $container): void
553553
}
554554

555555
/** @phpstan-ignore argument.type (Needed for the $reflector parameter) */
556-
$container->registerAttributeForAutoconfiguration(AsDatabaseType::class, RegisterDbalTypePass::autoconfigureFromAttribute(...));
556+
$container->registerAttributeForAutoconfiguration(AsDbalType::class, RegisterDbalTypePass::autoconfigureFromAttribute(...));
557557

558558
$container->registerForAutoconfiguration(MiddlewareInterface::class)->addTag('doctrine.middleware');
559559

tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
66

77
use Closure;
8-
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDatabaseType;
8+
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDbalType;
99
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener;
1010
use Doctrine\Bundle\DoctrineBundle\Attribute\AsEntityListener;
1111
use Doctrine\Bundle\DoctrineBundle\CacheWarmer\DoctrineMetadataCacheWarmer;
@@ -969,13 +969,13 @@ public function testAsDatabaseTypeAttribute(string $typeClassname, string $expec
969969
? array_map(static fn (array $arr) => $arr[0], $container->getAttributeAutoconfigurators())
970970
/** @phpstan-ignore method.notFound */
971971
: $container->getAutoconfiguredAttributes();
972-
$this->assertInstanceOf(Closure::class, $attributes[AsDatabaseType::class]);
972+
$this->assertInstanceOf(Closure::class, $attributes[AsDbalType::class]);
973973

974974
$reflector = new ReflectionClass($typeClassname);
975975
$definition = new ChildDefinition('');
976-
$attribute = $reflector->getAttributes(AsDatabaseType::class)[0]->newInstance();
976+
$attribute = $reflector->getAttributes(AsDbalType::class)[0]->newInstance();
977977

978-
$attributes[AsDatabaseType::class]($definition, $attribute, $reflector);
978+
$attributes[AsDbalType::class]($definition, $attribute, $reflector);
979979

980980
$expected = ['type_name' => $expectedTypeName];
981981
$this->assertSame([$expected], $definition->getTag('doctrine.dbal.type'));

tests/DependencyInjection/Fixtures/DbalType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\Fixtures;
66

7-
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDatabaseType;
7+
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDbalType;
88
use Doctrine\DBAL\Platforms\AbstractPlatform;
99
use Doctrine\DBAL\Types\Type;
1010

11-
#[AsDatabaseType(name: 'dbal_type')]
11+
#[AsDbalType(name: 'dbal_type')]
1212
class DbalType extends Type
1313
{
1414
/** @param array<string, mixed> $column */

tests/DependencyInjection/Fixtures/DbalTypeNoName.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\Fixtures;
66

7-
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDatabaseType;
7+
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDbalType;
88
use Doctrine\DBAL\Platforms\AbstractPlatform;
99
use Doctrine\DBAL\Types\Type;
1010

11-
#[AsDatabaseType]
11+
#[AsDbalType]
1212
class DbalTypeNoName extends Type
1313
{
1414
/** @param array<string, mixed> $column */

0 commit comments

Comments
 (0)