diff --git a/docs/en/cookbook/sql-table-prefixes.rst b/docs/en/cookbook/sql-table-prefixes.rst index 5ea587986b6..dc4ae6952df 100644 --- a/docs/en/cookbook/sql-table-prefixes.rst +++ b/docs/en/cookbook/sql-table-prefixes.rst @@ -47,7 +47,7 @@ appropriate autoloaders. } foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) { - if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY && $mapping['isOwningSide']) { + if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadata::MANY_TO_MANY && $mapping['isOwningSide']) { $mappedTableName = $mapping['joinTable']['name']; $classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName; } diff --git a/docs/en/reference/metadata-drivers.rst b/docs/en/reference/metadata-drivers.rst index 6e0e4d4a698..a64eb5b1e3d 100644 --- a/docs/en/reference/metadata-drivers.rst +++ b/docs/en/reference/metadata-drivers.rst @@ -54,51 +54,66 @@ Implementing Metadata Drivers In addition to the included metadata drivers you can very easily implement your own. All you need to do is define a class which -implements the ``Driver`` interface: +implements the ``MappingDriver`` interface: .. code-block:: php $className + * @psalm-param ClassMetadata $metadata + * + * @return void + * + * @template T of object */ - function loadMetadataForClass($className, ClassMetadataInfo $metadata); - + public function loadMetadataForClass(string $className, ClassMetadata $metadata); + /** * Gets the names of all mapped classes known to this driver. - * - * @return array The names of all mapped classes known to this driver. + * + * @return array The names of all mapped classes known to this driver. + * @psalm-return list */ - function getAllClassNames(); - + public function getAllClassNames(); + /** - * Whether the class with the specified name should have its metadata loaded. - * This is only the case if it is either mapped as an Entity or a - * MappedSuperclass. + * Returns whether the class with the specified name should have its metadata loaded. + * This is only the case if it is either mapped as an Entity or a MappedSuperclass. + * + * @psalm-param class-string $className * - * @param string $className - * @return boolean + * @return bool */ - function isTransient($className); + public function isTransient(string $className); } If you want to write a metadata driver to parse information from some file format we've made your life a little easier by providing -the ``AbstractFileDriver`` implementation for you to extend from: +the ``FileDriver`` implementation for you to extend from: .. code-block:: php _loadMappingFile($file); - // populate ClassMetadataInfo instance from $data + // populate ClassMetadata instance from $data } /** @@ -126,13 +141,12 @@ the ``AbstractFileDriver`` implementation for you to extend from: .. note:: - When using the ``AbstractFileDriver`` it requires that you - only have one entity defined per file and the file named after the - class described inside where namespace separators are replaced by - periods. So if you have an entity named ``Entities\User`` and you - wanted to write a mapping file for your driver above you would need - to name the file ``Entities.User.dcm.ext`` for it to be - recognized. + When using the ``FileDriver`` it requires that you only have one + entity defined per file and the file named after the class described + inside where namespace separators are replaced by periods. So if you + have an entity named ``Entities\User`` and you wanted to write a + mapping file for your driver above you would need to name the file + ``Entities.User.dcm.ext`` for it to be recognized. Now you can use your ``MyMetadataDriver`` implementation by setting @@ -155,14 +169,6 @@ entity when needed. You have all the methods you need to manually specify the mapping information instead of using some mapping file to populate it from. -The base ``ClassMetadataInfo`` class is responsible for only data -storage and is not meant for runtime use. It does not require that -the class actually exists yet so it is useful for describing some -entity before it exists and using that information to generate for -example the entities themselves. The class ``ClassMetadata`` -extends ``ClassMetadataInfo`` and adds some functionality required -for runtime usage and requires that the PHP class is present and -can be autoloaded. You can read more about the API of the ``ClassMetadata`` classes in the PHP Mapping chapter. diff --git a/docs/en/reference/php-mapping.rst b/docs/en/reference/php-mapping.rst index 2b822802c40..d06866bbe46 100644 --- a/docs/en/reference/php-mapping.rst +++ b/docs/en/reference/php-mapping.rst @@ -107,13 +107,12 @@ It also has several methods that create builders (which are necessary for advanc - ``createManyToMany($name, $targetEntity)`` returns an ``ManyToManyAssociationBuilder`` instance - ``createOneToMany($name, $targetEntity)`` returns an ``OneToManyAssociationBuilder`` instance -ClassMetadataInfo API ---------------------- +ClassMetadata API +----------------- -The ``ClassMetadataInfo`` class is the base data object for storing -the mapping metadata for a single entity. It contains all the -getters and setters you need populate and retrieve information for -an entity. +The ``ClassMetadata`` class is the data object for storing the mapping +metadata for a single entity. It contains all the getters and setters +you need populate and retrieve information for an entity. General Setters ~~~~~~~~~~~~~~~ @@ -231,13 +230,11 @@ Lifecycle Callback Getters - ``hasLifecycleCallbacks($lifecycleEvent)`` - ``getLifecycleCallbacks($event)`` -ClassMetadata API ------------------ +Runtime reflection methods +~~~~~~~~~~~~~~~~~~~~~~~~~~ -The ``ClassMetadata`` class extends ``ClassMetadataInfo`` and adds -the runtime functionality required by Doctrine. It adds a few extra -methods related to runtime reflection for working with the entities -themselves. +These are methods related to runtime reflection for working with the +entities themselves. - ``getReflectionClass()`` diff --git a/docs/en/reference/tools.rst b/docs/en/reference/tools.rst index 839174aa9c9..a438fb2789b 100644 --- a/docs/en/reference/tools.rst +++ b/docs/en/reference/tools.rst @@ -135,7 +135,7 @@ When using the SchemaTool class directly, create your schema using the ``createSchema()`` method. First create an instance of the ``SchemaTool`` and pass it an instance of the ``EntityManager`` that you want to use to create the schema. This method receives an -array of ``ClassMetadataInfo`` instances. +array of ``ClassMetadata`` instances. .. code-block:: php @@ -166,8 +166,8 @@ tables of the current model to clean up with orphaned tables. You can also use database introspection to update your schema easily with the ``updateSchema()`` method. It will compare your -existing database schema to the passed array of -``ClassMetadataInfo`` instances. +existing database schema to the passed array of ``ClassMetadata`` +instances. .. code-block:: php diff --git a/tests/Doctrine/Tests/Models/CMS/CmsAddress.php b/tests/Doctrine/Tests/Models/CMS/CmsAddress.php index 9a60f6fb597..6abb9cc76f9 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsAddress.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsAddress.php @@ -6,7 +6,7 @@ use Doctrine\ORM\Events; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\ColumnResult; use Doctrine\ORM\Mapping\Entity; @@ -138,7 +138,7 @@ public function setUser(CmsUser $user): void } } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->setPrimaryTable( ['name' => 'company_person'] diff --git a/tests/Doctrine/Tests/Models/CMS/CmsUser.php b/tests/Doctrine/Tests/Models/CMS/CmsUser.php index c77928ef7c1..bd2276915cc 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsUser.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsUser.php @@ -6,7 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\ColumnResult; use Doctrine\ORM\Mapping\Entity; @@ -297,7 +297,7 @@ public function setEmail(?CmsEmail $email = null): void } } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->setPrimaryTable( ['name' => 'cms_users'] diff --git a/tests/Doctrine/Tests/Models/Cache/City.php b/tests/Doctrine/Tests/Models/Cache/City.php index 5b285538318..1734aca1a49 100644 --- a/tests/Doctrine/Tests/Models/Cache/City.php +++ b/tests/Doctrine/Tests/Models/Cache/City.php @@ -8,7 +8,7 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping\Cache; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\GeneratedValue; @@ -136,16 +136,16 @@ public function getAttractions(): Collection return $this->attractions; } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { - $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); + $metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_NONE); $metadata->setPrimaryTable(['name' => 'cache_city']); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_IDENTITY); - $metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_IDENTITY); + $metadata->setChangeTrackingPolicy(ClassMetadata::CHANGETRACKING_DEFERRED_IMPLICIT); $metadata->enableCache( [ - 'usage' => ClassMetadataInfo::CACHE_USAGE_READ_ONLY, + 'usage' => ClassMetadata::CACHE_USAGE_READ_ONLY, ] ); @@ -179,7 +179,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ] ); $metadata->enableAssociationCache('state', [ - 'usage' => ClassMetadataInfo::CACHE_USAGE_READ_ONLY, + 'usage' => ClassMetadata::CACHE_USAGE_READ_ONLY, ]); $metadata->mapManyToMany( @@ -199,7 +199,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ] ); $metadata->enableAssociationCache('attractions', [ - 'usage' => ClassMetadataInfo::CACHE_USAGE_READ_ONLY, + 'usage' => ClassMetadata::CACHE_USAGE_READ_ONLY, ]); } } diff --git a/tests/Doctrine/Tests/Models/Company/CompanyContract.php b/tests/Doctrine/Tests/Models/Company/CompanyContract.php index 94bac17462c..f0aa25d78b9 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyContract.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyContract.php @@ -9,7 +9,6 @@ use Doctrine\ORM\Events; use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\DiscriminatorColumn; use Doctrine\ORM\Mapping\DiscriminatorMap; @@ -156,7 +155,7 @@ public function removeEngineer(CompanyEmployee $engineer): void abstract public function calculatePrice(): int; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_JOINED); $metadata->setTableName('company_contracts'); diff --git a/tests/Doctrine/Tests/Models/Company/CompanyFixContract.php b/tests/Doctrine/Tests/Models/Company/CompanyFixContract.php index 34571c889c5..13ef3b53f8d 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyFixContract.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyFixContract.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\Company; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; @@ -36,7 +36,7 @@ public function setFixPrice($fixPrice): void $this->fixPrice = $fixPrice; } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyFlexContract.php b/tests/Doctrine/Tests/Models/Company/CompanyFlexContract.php index c2fc3269f3d..d258fff0bd2 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyFlexContract.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyFlexContract.php @@ -6,7 +6,7 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\EntityResult; @@ -126,7 +126,7 @@ public function removeManager(CompanyManager $manager): void $this->managers->removeElement($manager); } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyFlexUltraContract.php b/tests/Doctrine/Tests/Models/Company/CompanyFlexUltraContract.php index 211bec111ae..53e8595c179 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyFlexUltraContract.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyFlexUltraContract.php @@ -6,7 +6,7 @@ use Doctrine\ORM\Events; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\EntityListeners; @@ -42,7 +42,7 @@ public function setMaxPrice(int $maxPrice): void $this->maxPrice = $maxPrice; } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyPerson.php b/tests/Doctrine/Tests/Models/Company/CompanyPerson.php index a2891ff5057..70d2bb3bbfe 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyPerson.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyPerson.php @@ -6,7 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\DiscriminatorColumn; use Doctrine\ORM\Mapping\DiscriminatorMap; @@ -139,7 +139,7 @@ public function setSpouse(CompanyPerson $spouse): void } } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->setPrimaryTable( ['name' => 'company_person'] diff --git a/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php b/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php index 8345120b423..33ca8199fb8 100644 --- a/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php +++ b/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\DDC1476; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\GeneratedValue; @@ -48,7 +48,7 @@ public function setName(string $name): void $this->name = $name; } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ @@ -60,6 +60,6 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ['fieldName' => 'name'] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); } } diff --git a/tests/Doctrine/Tests/Models/DDC3579/DDC3579User.php b/tests/Doctrine/Tests/Models/DDC3579/DDC3579User.php index a5daba7e68c..4d6c86a5b6e 100644 --- a/tests/Doctrine/Tests/Models/DDC3579/DDC3579User.php +++ b/tests/Doctrine/Tests/Models/DDC3579/DDC3579User.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\DDC3579; use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\GeneratedValue; use Doctrine\ORM\Mapping\Id; @@ -105,6 +105,6 @@ public static function loadMetadata($metadata): void ] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO); } } diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php index 1b5b335e49e..a89cb2304ce 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\DDC869; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; @@ -22,7 +22,7 @@ class DDC869ChequePayment extends DDC869Payment #[ORM\Column(type: 'string')] protected $serialNumber; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php index 0edac07476a..0df07fbe05d 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\DDC869; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; @@ -22,7 +22,7 @@ class DDC869CreditCardPayment extends DDC869Payment #[ORM\Column(type: 'string')] protected $creditCardNumber; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php index 26e1c6a2af7..6ade87d43f7 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\DDC869; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\GeneratedValue; use Doctrine\ORM\Mapping\Id; @@ -33,7 +33,7 @@ class DDC869Payment #[ORM\Column(type: 'float')] protected $value; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ @@ -51,6 +51,6 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ); $metadata->isMappedSuperclass = true; $metadata->setCustomRepositoryClass(DDC869PaymentRepository::class); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO); } } diff --git a/tests/Doctrine/Tests/Models/DDC889/DDC889Class.php b/tests/Doctrine/Tests/Models/DDC889/DDC889Class.php index 676af08ea38..c9533aa18c5 100644 --- a/tests/Doctrine/Tests/Models/DDC889/DDC889Class.php +++ b/tests/Doctrine/Tests/Models/DDC889/DDC889Class.php @@ -4,7 +4,7 @@ namespace Doctrine\Tests\Models\DDC889; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\GeneratedValue; use Doctrine\ORM\Mapping\Id; @@ -19,7 +19,7 @@ class DDC889Class extends DDC889SuperClass */ protected $id; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ @@ -30,6 +30,6 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO); } } diff --git a/tests/Doctrine/Tests/Models/DDC889/DDC889Entity.php b/tests/Doctrine/Tests/Models/DDC889/DDC889Entity.php index 6aa7e500d14..eeb4b3bdadc 100644 --- a/tests/Doctrine/Tests/Models/DDC889/DDC889Entity.php +++ b/tests/Doctrine/Tests/Models/DDC889/DDC889Entity.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\DDC889; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Entity; /** @@ -14,7 +14,7 @@ #[ORM\Entity] class DDC889Entity extends DDC889SuperClass { - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { } } diff --git a/tests/Doctrine/Tests/Models/DDC889/DDC889SuperClass.php b/tests/Doctrine/Tests/Models/DDC889/DDC889SuperClass.php index b9ca94f3908..7e8acc50fc3 100644 --- a/tests/Doctrine/Tests/Models/DDC889/DDC889SuperClass.php +++ b/tests/Doctrine/Tests/Models/DDC889/DDC889SuperClass.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\Models\DDC889; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\MappedSuperclass; @@ -22,13 +22,13 @@ class DDC889SuperClass #[ORM\Column] protected $name; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( ['fieldName' => 'name'] ); $metadata->isMappedSuperclass = true; - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); } } diff --git a/tests/Doctrine/Tests/Models/DDC964/DDC964Admin.php b/tests/Doctrine/Tests/Models/DDC964/DDC964Admin.php index 71bd1e74fbb..bcde2787862 100644 --- a/tests/Doctrine/Tests/Models/DDC964/DDC964Admin.php +++ b/tests/Doctrine/Tests/Models/DDC964/DDC964Admin.php @@ -6,7 +6,7 @@ use Doctrine\ORM\Mapping\AssociationOverride; use Doctrine\ORM\Mapping\AssociationOverrides; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\JoinColumn; use Doctrine\ORM\Mapping\JoinTable; @@ -32,7 +32,7 @@ #[AssociationOverrides([new AssociationOverride(name: 'groups', joinTable: new JoinTable(name: 'ddc964_users_admingroups'), joinColumns: [new JoinColumn(name: 'adminuser_id')], inverseJoinColumns: [new JoinColumn(name: 'admingroup_id')]), new AssociationOverride(name: 'address', joinColumns: [new JoinColumn(name: 'adminaddress_id', referencedColumnName: 'id')])])] class DDC964Admin extends DDC964User { - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->setAssociationOverride( 'address', diff --git a/tests/Doctrine/Tests/Models/DDC964/DDC964Guest.php b/tests/Doctrine/Tests/Models/DDC964/DDC964Guest.php index afe8a6c47ec..d5967dbec92 100644 --- a/tests/Doctrine/Tests/Models/DDC964/DDC964Guest.php +++ b/tests/Doctrine/Tests/Models/DDC964/DDC964Guest.php @@ -6,7 +6,7 @@ use Doctrine\ORM\Mapping\AttributeOverride; use Doctrine\ORM\Mapping\AttributeOverrides; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; @@ -34,7 +34,7 @@ #[AttributeOverrides([new AttributeOverride(name: 'id', column: new Column(name: 'guest_id', type: 'integer', length: 140)), new AttributeOverride(name: 'name', column: new Column(name: 'guest_name', nullable: false, unique: true, length: 240))])] class DDC964Guest extends DDC964User { - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->setAttributeOverride('id', [ 'columnName' => 'guest_id', diff --git a/tests/Doctrine/Tests/Models/DDC964/DDC964User.php b/tests/Doctrine/Tests/Models/DDC964/DDC964User.php index 9c2eb2ed48d..f3b477c96ca 100644 --- a/tests/Doctrine/Tests/Models/DDC964/DDC964User.php +++ b/tests/Doctrine/Tests/Models/DDC964/DDC964User.php @@ -6,7 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\GeneratedValue; use Doctrine\ORM\Mapping\Id; @@ -107,7 +107,7 @@ public function setAddress(DDC964Address $address): void $this->address = $address; } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->isMappedSuperclass = true; @@ -164,6 +164,6 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO); } } diff --git a/tests/Doctrine/Tests/Models/Enums/Card.php b/tests/Doctrine/Tests/Models/Enums/Card.php index 5cfcaad4273..bd533e090ee 100644 --- a/tests/Doctrine/Tests/Models/Enums/Card.php +++ b/tests/Doctrine/Tests/Models/Enums/Card.php @@ -4,7 +4,7 @@ namespace Doctrine\Tests\Models\Enums; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\GeneratedValue; @@ -28,7 +28,7 @@ class Card #[Column(type: 'string', enumType: Suit::class)] public $suit; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/Models/Enums/CardWithNullable.php b/tests/Doctrine/Tests/Models/Enums/CardWithNullable.php index ea35461a81e..81f991a7c60 100644 --- a/tests/Doctrine/Tests/Models/Enums/CardWithNullable.php +++ b/tests/Doctrine/Tests/Models/Enums/CardWithNullable.php @@ -4,7 +4,7 @@ namespace Doctrine\Tests\Models\Enums; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\GeneratedValue; @@ -28,7 +28,7 @@ class CardWithNullable #[Column(type: 'string', nullable: true, enumType: Suit::class)] public $suit; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/Models/Enums/Scale.php b/tests/Doctrine/Tests/Models/Enums/Scale.php index 45e56a00019..f101bc0c445 100644 --- a/tests/Doctrine/Tests/Models/Enums/Scale.php +++ b/tests/Doctrine/Tests/Models/Enums/Scale.php @@ -4,7 +4,7 @@ namespace Doctrine\Tests\Models\Enums; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\GeneratedValue; @@ -28,7 +28,7 @@ class Scale #[Column(type: 'simple_array', enumType: Unit::class)] public $supportedUnits; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/Models/TypedProperties/UserTyped.php b/tests/Doctrine/Tests/Models/TypedProperties/UserTyped.php index 2a4defddb31..ad5af325cf6 100644 --- a/tests/Doctrine/Tests/Models/TypedProperties/UserTyped.php +++ b/tests/Doctrine/Tests/Models/TypedProperties/UserTyped.php @@ -8,7 +8,7 @@ use DateTime; use DateTimeImmutable; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Embedded; use Doctrine\ORM\Mapping\Entity; @@ -82,9 +82,9 @@ class UserTyped #[ORM\Embedded] public ?Contact $contact = null; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { - $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); + $metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_NONE); $metadata->setPrimaryTable( ['name' => 'cms_users_typed'] ); @@ -95,7 +95,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void 'fieldName' => 'id', ] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO); $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/Models/Upsertable/Insertable.php b/tests/Doctrine/Tests/Models/Upsertable/Insertable.php index 3ebfc1a76ff..8747d3ca60e 100644 --- a/tests/Doctrine/Tests/Models/Upsertable/Insertable.php +++ b/tests/Doctrine/Tests/Models/Upsertable/Insertable.php @@ -5,7 +5,6 @@ namespace Doctrine\Tests\Models\Upsertable; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\GeneratedValue; @@ -62,7 +61,7 @@ public static function loadMetadata(ClassMetadata $metadata): ClassMetadata 'fieldName' => 'nonInsertableContent', 'notInsertable' => true, 'options' => ['default' => '1234'], - 'generated' => ClassMetadataInfo::GENERATED_INSERT, + 'generated' => ClassMetadata::GENERATED_INSERT, ] ); $metadata->mapField( diff --git a/tests/Doctrine/Tests/Models/Upsertable/Updatable.php b/tests/Doctrine/Tests/Models/Upsertable/Updatable.php index bd793773512..37b4b62767e 100644 --- a/tests/Doctrine/Tests/Models/Upsertable/Updatable.php +++ b/tests/Doctrine/Tests/Models/Upsertable/Updatable.php @@ -5,7 +5,6 @@ namespace Doctrine\Tests\Models\Upsertable; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\GeneratedValue; @@ -60,7 +59,7 @@ public static function loadMetadata(ClassMetadata $metadata): ClassMetadata [ 'fieldName' => 'nonUpdatableContent', 'notUpdatable' => true, - 'generated' => ClassMetadataInfo::GENERATED_ALWAYS, + 'generated' => ClassMetadata::GENERATED_ALWAYS, ] ); $metadata->mapField( diff --git a/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTest.php b/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTest.php index 717a668618e..6b60c3f7909 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTest.php @@ -9,7 +9,7 @@ use Doctrine\DBAL\Platforms\SQLServerPlatform; use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\Table; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use function array_change_key_case; use function count; @@ -117,7 +117,7 @@ public function testLoadMetadataWithForeignKeyFromDatabase(): void $bazMetadata->associationMappings = array_change_key_case($bazMetadata->associationMappings, CASE_LOWER); self::assertArrayHasKey('bar', $bazMetadata->associationMappings); - self::assertEquals(ClassMetadataInfo::MANY_TO_ONE, $bazMetadata->associationMappings['bar']['type']); + self::assertEquals(ClassMetadata::MANY_TO_ONE, $bazMetadata->associationMappings['bar']['type']); } public function testDetectManyToManyTables(): void diff --git a/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTestCase.php b/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTestCase.php index a7e580646d5..3f44040975d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTestCase.php +++ b/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTestCase.php @@ -21,7 +21,7 @@ abstract class DatabaseDriverTestCase extends OrmFunctionalTestCase { /** - * @psalm-return array + * @psalm-return array */ protected function convertToClassMetadata(array $entityTables, array $manyTables = []): array { @@ -42,7 +42,7 @@ protected function convertToClassMetadata(array $entityTables, array $manyTables /** * @param string[] $classNames * - * @psalm-return array + * @psalm-return array */ protected function extractClassMetadata(array $classNames): array { diff --git a/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php b/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php index 12dd5f17fd4..bf39db8ca20 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php @@ -4,7 +4,7 @@ namespace Doctrine\Tests\ORM\Functional; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Tests\Models\CMS\CmsArticle; use Doctrine\Tests\Models\CMS\CmsGroup; use Doctrine\Tests\Models\CMS\CmsPhonenumber; @@ -59,11 +59,11 @@ protected function setUp(): void parent::setUp(); $class = $this->_em->getClassMetadata(CmsUser::class); - $class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['groups']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; $class->associationMappings['groups']['indexBy'] = 'name'; - $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; $class->associationMappings['articles']['indexBy'] = 'topic'; - $class->associationMappings['phonenumbers']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['phonenumbers']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; $class->associationMappings['phonenumbers']['indexBy'] = 'phonenumber'; foreach (['phonenumbers', 'articles', 'users'] as $field) { @@ -75,7 +75,7 @@ protected function setUp(): void } $class = $this->_em->getClassMetadata(CmsGroup::class); - $class->associationMappings['users']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['users']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; $class->associationMappings['users']['indexBy'] = 'username'; $this->loadFixture(); @@ -86,9 +86,9 @@ public function tearDown(): void parent::tearDown(); $class = $this->_em->getClassMetadata(CmsUser::class); - $class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_LAZY; - $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY; - $class->associationMappings['phonenumbers']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + $class->associationMappings['groups']['fetch'] = ClassMetadata::FETCH_LAZY; + $class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_LAZY; + $class->associationMappings['phonenumbers']['fetch'] = ClassMetadata::FETCH_LAZY; foreach (['phonenumbers', 'articles', 'users'] as $field) { if (isset($this->previousCacheConfig[$field])) { @@ -102,7 +102,7 @@ public function tearDown(): void unset($class->associationMappings['phonenumbers']['indexBy']); $class = $this->_em->getClassMetadata(CmsGroup::class); - $class->associationMappings['users']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + $class->associationMappings['users']['fetch'] = ClassMetadata::FETCH_LAZY; unset($class->associationMappings['users']['indexBy']); } diff --git a/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php b/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php index 4e8511682d3..8687074bd07 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php @@ -9,7 +9,6 @@ use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Query\Filter\FilterException; use Doctrine\ORM\Query\Filter\SQLFilter; use Doctrine\ORM\Query\FilterCollection; @@ -68,8 +67,8 @@ public function tearDown(): void parent::tearDown(); $class = $this->_em->getClassMetadata(CmsUser::class); - $class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_LAZY; - $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + $class->associationMappings['groups']['fetch'] = ClassMetadata::FETCH_LAZY; + $class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_LAZY; } public function testConfigureFilter(): void @@ -564,8 +563,8 @@ public function testWhereOrFilter(): void private function loadLazyFixtureData(): void { $class = $this->_em->getClassMetadata(CmsUser::class); - $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; - $class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; + $class->associationMappings['groups']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; $this->loadFixtureData(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php index 1fa7f783dd5..f3049476bcb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php @@ -4,7 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Tests\Models; use Doctrine\Tests\OrmFunctionalTestCase; @@ -23,9 +23,9 @@ protected function setUp(): void parent::setUp(); $class = $this->_em->getClassMetadata(Models\Legacy\LegacyUser::class); - $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; - $class->associationMappings['references']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; - $class->associationMappings['cars']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY; + $class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; + $class->associationMappings['references']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; + $class->associationMappings['cars']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; $this->loadFixture(); } @@ -35,9 +35,9 @@ public function tearDown(): void parent::tearDown(); $class = $this->_em->getClassMetadata(Models\Legacy\LegacyUser::class); - $class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY; - $class->associationMappings['references']['fetch'] = ClassMetadataInfo::FETCH_LAZY; - $class->associationMappings['cars']['fetch'] = ClassMetadataInfo::FETCH_LAZY; + $class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_LAZY; + $class->associationMappings['references']['fetch'] = ClassMetadata::FETCH_LAZY; + $class->associationMappings['cars']['fetch'] = ClassMetadata::FETCH_LAZY; } public function testCountNotInitializesLegacyCollection(): void diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2387Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2387Test.php index 8ac3c3c4f31..f3fbaa5cb3a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2387Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2387Test.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\DBAL\Schema\Table; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Tests\ORM\Functional\DatabaseDriverTestCase; class DDC2387Test extends DatabaseDriverTestCase @@ -27,7 +27,7 @@ public function testCompositeAssociationKeyDetection(): void $metadata = $this->convertToClassMetadata([$product, $attributes], []); - self::assertEquals(ClassMetadataInfo::GENERATOR_TYPE_NONE, $metadata['Ddc2387Attributes']->generatorType); - self::assertEquals(ClassMetadataInfo::GENERATOR_TYPE_AUTO, $metadata['Ddc2387Product']->generatorType); + self::assertEquals(ClassMetadata::GENERATOR_TYPE_NONE, $metadata['Ddc2387Attributes']->generatorType); + self::assertEquals(ClassMetadata::GENERATOR_TYPE_AUTO, $metadata['Ddc2387Product']->generatorType); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2415Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2415Test.php index cb42eb82daa..871d022e409 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2415Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2415Test.php @@ -6,7 +6,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Id\AbstractIdGenerator; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Driver\StaticPHPDriver; use Doctrine\Tests\OrmFunctionalTestCase; @@ -63,7 +63,7 @@ public function getId(): string return $this->id; } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ @@ -73,7 +73,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_CUSTOM); $metadata->setCustomGeneratorDefinition(['class' => DDC2415Generator::class]); $metadata->isMappedSuperclass = true; @@ -95,7 +95,7 @@ public function getName(): string return $this->name; } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php index 4906cdb44ba..caa252e7c99 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php @@ -18,7 +18,7 @@ class DDC3103Test extends OrmFunctionalTestCase { /** - * @covers \Doctrine\ORM\Mapping\ClassMetadataInfo::__sleep + * @covers \Doctrine\ORM\Mapping\ClassMetadata::__sleep */ public function testIssue(): void { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php index 63922eaa8f2..eb928fcb333 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php @@ -4,7 +4,7 @@ namespace Doctrine\Test\ORM\Functional\Ticket; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Tests\OrmFunctionalTestCase; final class GH6682Test extends OrmFunctionalTestCase @@ -20,7 +20,7 @@ public function testIssue(): void 'initialValue' => '', ]; - $classMetadataInfo = new ClassMetadataInfo('test_entity'); + $classMetadataInfo = new ClassMetadata('test_entity'); $classMetadataInfo->setSequenceGeneratorDefinition($parsedDefinition); self::assertSame( diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index 995b20039aa..084e84d72a1 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -10,7 +10,6 @@ use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadataFactory; -use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\CustomIdGenerator; use Doctrine\ORM\Mapping\DefaultNamingStrategy; @@ -547,7 +546,7 @@ public function testDefaultFieldType(): void self::assertEquals('id', $class->fieldMappings['id']['columnName']); self::assertEquals('name', $class->fieldMappings['name']['columnName']); - self::assertEquals(ClassMetadataInfo::GENERATOR_TYPE_NONE, $class->generatorType); + self::assertEquals(ClassMetadata::GENERATOR_TYPE_NONE, $class->generatorType); } /** @@ -1076,7 +1075,7 @@ public function testInsertableColumn(): void self::assertArrayHasKey('notInsertable', $mapping); self::assertArrayHasKey('generated', $mapping); - self::assertSame(ClassMetadataInfo::GENERATED_INSERT, $mapping['generated']); + self::assertSame(ClassMetadata::GENERATED_INSERT, $mapping['generated']); self::assertArrayNotHasKey('notInsertable', $metadata->getFieldMapping('insertableContent')); } @@ -1088,7 +1087,7 @@ public function testUpdatableColumn(): void self::assertArrayHasKey('notUpdatable', $mapping); self::assertArrayHasKey('generated', $mapping); - self::assertSame(ClassMetadataInfo::GENERATED_ALWAYS, $mapping['generated']); + self::assertSame(ClassMetadata::GENERATED_ALWAYS, $mapping['generated']); self::assertArrayNotHasKey('notUpdatable', $metadata->getFieldMapping('updatableContent')); } @@ -1209,16 +1208,16 @@ public function doStuffOnPostPersist(): void { } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { - $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); + $metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_NONE); $metadata->setPrimaryTable( [ 'name' => 'cms_users', 'options' => ['foo' => 'bar', 'baz' => ['key' => 'val']], ] ); - $metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT); + $metadata->setChangeTrackingPolicy(ClassMetadata::CHANGETRACKING_DEFERRED_IMPLICIT); $metadata->addLifecycleCallback('doStuffOnPrePersist', 'prePersist'); $metadata->addLifecycleCallback('doOtherStuffOnPrePersistToo', 'prePersist'); $metadata->addLifecycleCallback('doStuffOnPostPersist', 'postPersist'); @@ -1253,7 +1252,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void $mapping = ['fieldName' => 'version', 'type' => 'integer']; $metadata->setVersionMapping($mapping); $metadata->mapField($mapping); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO); $metadata->mapOneToOne( [ 'fieldName' => 'address', @@ -1372,9 +1371,9 @@ class UserIncorrectIndex */ public $email; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { - $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); + $metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_NONE); $metadata->setPrimaryTable([]); $metadata->mapField( [ @@ -1431,9 +1430,9 @@ class UserIncorrectUniqueConstraint */ public $email; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { - $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); + $metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_NONE); $metadata->setPrimaryTable([]); $metadata->mapField( [ @@ -1483,9 +1482,9 @@ abstract class Animal #[ORM\CustomIdGenerator(class: 'stdClass')] public $id; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_CUSTOM); $metadata->setCustomGeneratorDefinition(['class' => 'stdClass']); } } @@ -1494,7 +1493,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void #[ORM\Entity] class Cat extends Animal { - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { } } @@ -1503,7 +1502,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void #[ORM\Entity] class Dog extends Animal { - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { } } @@ -1546,7 +1545,7 @@ public function getValue(): ?string return $this->value; } - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ @@ -1563,7 +1562,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); } } @@ -1587,7 +1586,7 @@ class DDC807Entity #[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue(strategy: 'NONE')] public $id; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ @@ -1604,7 +1603,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); } } @@ -1640,9 +1639,9 @@ class Comment #[ORM\Column(type: 'text')] private $content; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { - $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); + $metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_NONE); $metadata->setPrimaryTable( [ 'indexes' => [ @@ -1687,7 +1686,7 @@ class SingleTableEntityNoDiscriminatorColumnMapping #[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue(strategy: 'NONE')] public $id; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ @@ -1696,7 +1695,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); } } @@ -1730,7 +1729,7 @@ class SingleTableEntityIncompleteDiscriminatorColumnMapping #[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue(strategy: 'NONE')] public $id; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ @@ -1739,7 +1738,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void ] ); - $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); } } @@ -1770,7 +1769,7 @@ class ReservedWordInTableColumn #[ORM\Column(name: '`count`', type: 'integer')] public $count; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ diff --git a/tests/Doctrine/Tests/ORM/Mapping/FieldBuilderTest.php b/tests/Doctrine/Tests/ORM/Mapping/FieldBuilderTest.php index c73a287ed00..cef9bbc723e 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/FieldBuilderTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/FieldBuilderTest.php @@ -5,7 +5,7 @@ namespace Doctrine\Tests\ORM\Mapping; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\OrmTestCase; @@ -13,7 +13,7 @@ class FieldBuilderTest extends OrmTestCase { public function testCustomIdGeneratorCanBeSet(): void { - $cmBuilder = new ClassMetadataBuilder(new ClassMetadataInfo(CmsUser::class)); + $cmBuilder = new ClassMetadataBuilder(new ClassMetadata(CmsUser::class)); $fieldBuilder = $cmBuilder->createField('aField', 'string'); @@ -22,7 +22,7 @@ public function testCustomIdGeneratorCanBeSet(): void $fieldBuilder->build(); - self::assertEquals(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM, $cmBuilder->getClassMetadata()->generatorType); + self::assertEquals(ClassMetadata::GENERATOR_TYPE_CUSTOM, $cmBuilder->getClassMetadata()->generatorType); self::assertEquals(['class' => 'stdClass'], $cmBuilder->getClassMetadata()->customGeneratorDefinition); } } diff --git a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Upsertable.Insertable.php b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Upsertable.Insertable.php index 403cdb2ef2e..42be971a2de 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Upsertable.Insertable.php +++ b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Upsertable.Insertable.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; $metadata->setPrimaryTable( ['name' => 'insertable_column'] @@ -14,14 +14,14 @@ 'fieldName' => 'id', ] ); -$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); +$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO); $metadata->mapField( [ 'fieldName' => 'nonInsertableContent', 'notInsertable' => true, 'options' => ['default' => '1234'], - 'generated' => ClassMetadataInfo::GENERATED_INSERT, + 'generated' => ClassMetadata::GENERATED_INSERT, ] ); $metadata->mapField( diff --git a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Upsertable.Updatable.php b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Upsertable.Updatable.php index 9fe2627c0e6..7a5746abda4 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Upsertable.Updatable.php +++ b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Upsertable.Updatable.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; $metadata->setPrimaryTable( ['name' => 'updatable_column'] @@ -14,13 +14,13 @@ 'fieldName' => 'id', ] ); -$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); +$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO); $metadata->mapField( [ 'fieldName' => 'nonUpdatableContent', 'notUpdatable' => true, - 'generated' => ClassMetadataInfo::GENERATED_ALWAYS, + 'generated' => ClassMetadata::GENERATED_ALWAYS, ] ); $metadata->mapField( diff --git a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php index 4dd7fcf0ad4..9c1763748d0 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php @@ -6,7 +6,6 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\Id; @@ -588,7 +587,7 @@ class IncorrectIndexByFieldEntity /** @var string */ public $fieldName; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [ @@ -627,7 +626,7 @@ class IncorrectUniqueConstraintByFieldEntity /** @var string */ public $fieldName; - public static function loadMetadata(ClassMetadataInfo $metadata): void + public static function loadMetadata(ClassMetadata $metadata): void { $metadata->mapField( [