Skip to content

Commit

Permalink
Deprecate the Annotation interface (doctrine#10178)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Oct 26, 2022
1 parent 1edfa91 commit 543be3f
Show file tree
Hide file tree
Showing 56 changed files with 72 additions and 52 deletions.
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ As a consequence, the following methods are deprecated:
- `ORMSetup::createAnnotationMetadataConfiguration`
- `ORMSetup::createDefaultAnnotationDriver`

The marker interface `Doctrine\ORM\Mapping\Annotation` is deprecated as well.
All annotation/attribute classes implement
`Doctrine\ORM\Mapping\MappingAttribute` now.

## Deprecated `Doctrine\ORM\Proxy\Proxy` interface.

Use `Doctrine\Persistence\Proxy` instead to check whether proxies are initialized.
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/Mapping/Annotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\ORM\Mapping;

/** @deprecated Use {@see MappingAttribute} instead. */
interface Annotation
{
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/AssociationOverride.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @NamedArgumentConstructor
* @Target("ANNOTATION")
*/
final class AssociationOverride implements Annotation
final class AssociationOverride implements MappingAttribute
{
/**
* The name of the relationship property whose mapping is being overridden.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/AssociationOverrides.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class AssociationOverrides implements Annotation
final class AssociationOverrides implements MappingAttribute
{
/**
* Mapping overrides of relationship properties.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/AttributeOverride.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @NamedArgumentConstructor
* @Target("ANNOTATION")
*/
final class AttributeOverride implements Annotation
final class AttributeOverride implements MappingAttribute
{
/**
* The name of the property whose mapping is being overridden.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/AttributeOverrides.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class AttributeOverrides implements Annotation
final class AttributeOverrides implements MappingAttribute
{
/**
* One or more field or property mapping overrides.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @Target({"CLASS","PROPERTY"})
*/
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY)]
final class Cache implements Annotation
final class Cache implements MappingAttribute
{
/**
* The concurrency strategy.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/ChangeTrackingPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class ChangeTrackingPolicy implements Annotation
final class ChangeTrackingPolicy implements MappingAttribute
{
/**
* The change tracking policy.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @Target({"PROPERTY","ANNOTATION"})
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class Column implements Annotation
final class Column implements MappingAttribute
{
/**
* @var string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/ColumnResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @Annotation
* @Target("ANNOTATION")
*/
final class ColumnResult implements Annotation
final class ColumnResult implements MappingAttribute
{
/**
* The name of a column in the SELECT clause of a SQL query.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/CustomIdGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("PROPERTY")
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class CustomIdGenerator implements Annotation
final class CustomIdGenerator implements MappingAttribute
{
/**
* @var string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/DiscriminatorColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class DiscriminatorColumn implements Annotation
final class DiscriminatorColumn implements MappingAttribute
{
/**
* @var string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/DiscriminatorMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class DiscriminatorMap implements Annotation
final class DiscriminatorMap implements MappingAttribute
{
/**
* @var array<int|string, string>
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

require_once __DIR__ . '/../Annotation.php';
require_once __DIR__ . '/../MappingAttribute.php';
require_once __DIR__ . '/../Entity.php';
require_once __DIR__ . '/../Embeddable.php';
require_once __DIR__ . '/../Embedded.php';
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/Embeddable.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class Embeddable implements Annotation
final class Embeddable implements MappingAttribute
{
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/Embedded.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("PROPERTY")
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class Embedded implements Annotation
final class Embedded implements MappingAttribute
{
/**
* @var string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @template T of object
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class Entity implements Annotation
final class Entity implements MappingAttribute
{
/**
* @var string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/EntityListeners.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class EntityListeners implements Annotation
final class EntityListeners implements MappingAttribute
{
/**
* Specifies the names of the entity listeners.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/EntityResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Annotation
* @Target("ANNOTATION")
*/
final class EntityResult implements Annotation
final class EntityResult implements MappingAttribute
{
/**
* The class of the result.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/FieldResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @Annotation
* @Target("ANNOTATION")
*/
final class FieldResult implements Annotation
final class FieldResult implements MappingAttribute
{
/**
* Name of the column in the SELECT clause.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/GeneratedValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("PROPERTY")
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class GeneratedValue implements Annotation
final class GeneratedValue implements MappingAttribute
{
/**
* The type of ID generator.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/HasLifecycleCallbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class HasLifecycleCallbacks implements Annotation
final class HasLifecycleCallbacks implements MappingAttribute
{
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/Id.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* @Target("PROPERTY")
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class Id implements Annotation
final class Id implements MappingAttribute
{
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("ANNOTATION")
*/
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
final class Index implements Annotation
final class Index implements MappingAttribute
{
/**
* @var string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/InheritanceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class InheritanceType implements Annotation
final class InheritanceType implements MappingAttribute
{
/**
* The inheritance type used by the class and its subclasses.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/InverseJoinColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Attribute;

#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
final class InverseJoinColumn implements Annotation
final class InverseJoinColumn implements MappingAttribute
{
use JoinColumnProperties;
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/JoinColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target({"PROPERTY","ANNOTATION"})
*/
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
final class JoinColumn implements Annotation
final class JoinColumn implements MappingAttribute
{
use JoinColumnProperties;
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/JoinColumns.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @Annotation
* @Target("PROPERTY")
*/
final class JoinColumns implements Annotation
final class JoinColumns implements MappingAttribute
{
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */
public $value;
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/JoinTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target({"PROPERTY","ANNOTATION"})
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class JoinTable implements Annotation
final class JoinTable implements MappingAttribute
{
/**
* @var string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/ManyToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @Target("PROPERTY")
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class ManyToMany implements Annotation
final class ManyToMany implements MappingAttribute
{
/**
* @var class-string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/ManyToOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("PROPERTY")
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class ManyToOne implements Annotation
final class ManyToOne implements MappingAttribute
{
/**
* @var class-string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/MappedSuperclass.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @Target("CLASS")
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class MappedSuperclass implements Annotation
final class MappedSuperclass implements MappingAttribute
{
/**
* @var string|null
Expand Down
10 changes: 10 additions & 0 deletions lib/Doctrine/ORM/Mapping/MappingAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Doctrine\ORM\Mapping;

/** A marker interface for mapping attributes. */
interface MappingAttribute extends Annotation
{
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/NamedNativeQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @Annotation
* @Target("CLASS")
*/
final class NamedNativeQueries implements Annotation
final class NamedNativeQueries implements MappingAttribute
{
/**
* One or more NamedNativeQuery annotations.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/NamedNativeQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @Annotation
* @Target("ANNOTATION")
*/
final class NamedNativeQuery implements Annotation
final class NamedNativeQuery implements MappingAttribute
{
/**
* The name used to refer to the query with the EntityManager methods that create query objects.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/NamedQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @Annotation
* @Target("CLASS")
*/
final class NamedQueries implements Annotation
final class NamedQueries implements MappingAttribute
{
/** @var array<\Doctrine\ORM\Mapping\NamedQuery> */
public $value;
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/NamedQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @Annotation
* @Target("ANNOTATION")
*/
final class NamedQuery implements Annotation
final class NamedQuery implements MappingAttribute
{
/** @var string */
public $name;
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/OneToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("PROPERTY")
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class OneToMany implements Annotation
final class OneToMany implements MappingAttribute
{
/**
* @var string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/OneToOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("PROPERTY")
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class OneToOne implements Annotation
final class OneToOne implements MappingAttribute
{
/**
* @var class-string|null
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/OrderBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Target("PROPERTY")
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class OrderBy implements Annotation
final class OrderBy implements MappingAttribute
{
/**
* @var array<string>
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/PostLoad.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_METHOD)]
final class PostLoad implements Annotation
final class PostLoad implements MappingAttribute
{
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/PostPersist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_METHOD)]
final class PostPersist implements Annotation
final class PostPersist implements MappingAttribute
{
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/PostRemove.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_METHOD)]
final class PostRemove implements Annotation
final class PostRemove implements MappingAttribute
{
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/PostUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_METHOD)]
final class PostUpdate implements Annotation
final class PostUpdate implements MappingAttribute
{
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/PreFlush.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_METHOD)]
final class PreFlush implements Annotation
final class PreFlush implements MappingAttribute
{
}

0 comments on commit 543be3f

Please sign in to comment.