mirror of
https://github.com/doctrine/mongodb-odm.git
synced 2026-03-23 22:42:15 +01:00
Change namespace of attribute classes from Annotations to Attribute (#2933)
- Move the classes from Doctrine\ODM\MongoDB\Mapping\Annotations to Doctrine\ODM\MongoDB\Mapping\Attribute. Removing the @Annotation so that they can't be used for legacy annotations. - For the classes in the Annotations namespace, they extend those from the Attribute namespace. Adding the legacy @Annotation for BC. - The EncryptQuery enum is moved to the parent Doctrine\ODM\MongoDB\Mapping namespace - The abstract annotation classes are aliased to the new abstract attribute classes, so that it's not breaking type comparison - Documentation updated
This commit is contained in:
@@ -1,5 +1,37 @@
|
||||
# UPGRADE FROM 2.15 to 2.16
|
||||
|
||||
## Attribute namespaces
|
||||
|
||||
Doctrine annotations are already deprecated in favor of PHP attributes.
|
||||
As of MongoDB ODM 2.16, the namespace of attribute classes has been changed from
|
||||
`Doctrine\ODM\MongoDB\Mapping\Annotations` to `Doctrine\ODM\MongoDB\Mapping\Attribute`.
|
||||
The old classes continue to work, but they are deprecated and will be removed in 3.0.
|
||||
|
||||
```diff
|
||||
- use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
|
||||
+ use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[ODM\Document]
|
||||
class User
|
||||
{
|
||||
#[ODM\Id]
|
||||
private string $id;
|
||||
|
||||
#[ODM\Field]
|
||||
public string $name;
|
||||
}
|
||||
```
|
||||
|
||||
The enum `Doctrine\ODM\MongoDB\Mapping\Annotations\EncryptQuery` has been moved to
|
||||
`Doctrine\ODM\MongoDB\Mapping\Attribute\EncryptQuery`.
|
||||
|
||||
[BC break] The classes `Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractDocument`,
|
||||
`AbstractField` and `AbstractIndex` does not implement
|
||||
`Doctrine\ODM\MongoDB\Mapping\Annotations\Annotation` anymore;
|
||||
they must not be used outside the `doctrine/mongodb-odm` package.
|
||||
The new abstract classes in the `Doctrine\ODM\MongoDB\Mapping\Attribute`
|
||||
are marked as `@internal`.
|
||||
|
||||
## Package `doctrine/cache` no longer required
|
||||
|
||||
If you use `Doctrine\ODM\MongoDB\Configuration::getMetadataCacheImpl()`,
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
"psr/cache": "^1.0 || ^2.0 || ^3.0",
|
||||
"symfony/console": "^5.4 || ^6.4 || ^7.0 || ^8.0",
|
||||
"symfony/deprecation-contracts": "^2.2 || ^3.0",
|
||||
"symfony/polyfill-php84": "^1.33",
|
||||
"symfony/var-dumper": "^5.4 || ^6.4 || ^7.0 || ^8.0",
|
||||
"symfony/var-exporter": "^6.4.1 || ^7.0 || ^8.0"
|
||||
},
|
||||
|
||||
@@ -113,7 +113,7 @@ Now map the same class to the Doctrine MongoDB ODM:
|
||||
namespace Documents\Blog;
|
||||
|
||||
use Documents\Blog\Repository\ODM\BlogPostRepository;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[ODM\Document(repositoryClass: BlogPostRepository::class)]
|
||||
class BlogPost
|
||||
|
||||
@@ -47,9 +47,8 @@ fields that require encryption.
|
||||
|
||||
namespace Documents;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Encrypt;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\EncryptQuery;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\EncryptQuery;
|
||||
|
||||
#[ODM\Document]
|
||||
class Patient
|
||||
@@ -69,7 +68,7 @@ fields that require encryption.
|
||||
* This allows us to find a patient by their exact SSN.
|
||||
*/
|
||||
#[ODM\Field(type: 'string')]
|
||||
#[Encrypt(queryType: EncryptQuery::Equality)]
|
||||
#[ODM\Encrypt(queryType: EncryptQuery::Equality)]
|
||||
public string $ssn;
|
||||
|
||||
/**
|
||||
@@ -77,7 +76,7 @@ fields that require encryption.
|
||||
* By not specifying a queryType, we make it non-queryable.
|
||||
*/
|
||||
#[ODM\EmbedOne(targetDocument: Billing::class)]
|
||||
#[Encrypt]
|
||||
#[ODM\Encrypt]
|
||||
public Billing $billing;
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,7 @@ First, we define the model for our data:
|
||||
<?php
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
use MongoDB\BSON\ObjectId;
|
||||
|
||||
#[ODM\Document]
|
||||
|
||||
@@ -175,7 +175,7 @@ the ``odm:schema:create`` or ``odm:schema:update`` command.
|
||||
|
||||
namespace Documents;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
|
||||
#[ODM\Document]
|
||||
|
||||
@@ -36,7 +36,7 @@ return the same result because Voyage AI uses normalized vectors to length 1.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
use Doctrine\ODM\MongoDB\Types\Type;
|
||||
use Symfony\AI\Platform\Vector\Vector;
|
||||
|
||||
@@ -25,7 +25,7 @@ Replace the ``@ODM\Document`` annotations with the ``#[ODM\Document]`` attribute
|
||||
|
||||
.. code-block:: diff
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
- /**
|
||||
- * @ODM\Document
|
||||
|
||||
@@ -368,14 +368,14 @@ Example:
|
||||
|
||||
<?php
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Encrypt;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\EncryptQuery;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\EncryptQuery;
|
||||
|
||||
#[Document]
|
||||
#[ODM\Document]
|
||||
class Client
|
||||
{
|
||||
#[Field]
|
||||
#[Encrypt(queryType: EncryptQuery::Equality)]
|
||||
#[ODM\Field]
|
||||
#[ODM\Encrypt(queryType: EncryptQuery::Equality)]
|
||||
public string $name;
|
||||
}
|
||||
|
||||
@@ -390,23 +390,23 @@ value in the parent document.
|
||||
|
||||
<?php
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Encrypt;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[Encrypt]
|
||||
#[EmbeddedDocument]
|
||||
#[ODM\Encrypt]
|
||||
#[ODM\EmbeddedDocument]
|
||||
class CreditCard
|
||||
{
|
||||
#[Field]
|
||||
#[ODM\Field]
|
||||
public string $number;
|
||||
|
||||
#[Field]
|
||||
#[ODM\Field]
|
||||
public string $expiryDate;
|
||||
}
|
||||
|
||||
#[Document]
|
||||
#[ODM\Document]
|
||||
class User
|
||||
{
|
||||
#[EmbedOne(targetDocument: CreditCard::class)]
|
||||
#[ODM\EmbedOne(targetDocument: CreditCard::class)]
|
||||
public CreditCard $creditCard;
|
||||
}
|
||||
|
||||
@@ -1476,15 +1476,12 @@ Example:
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\VectorSearchIndex;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
use Doctrine\ODM\MongoDB\Types\Type;
|
||||
|
||||
#[Document(collection: 'vector_embeddings')]
|
||||
#[VectorSearchIndex(
|
||||
#[ODM\Document(collection: 'vector_embeddings')]
|
||||
#[ODM\VectorSearchIndex(
|
||||
fields: [
|
||||
[
|
||||
'type' => 'vector',
|
||||
@@ -1501,14 +1498,14 @@ Example:
|
||||
)]
|
||||
class VectorEmbedding
|
||||
{
|
||||
#[Id]
|
||||
#[ODM\Id]
|
||||
public ?string $id = null;
|
||||
|
||||
/** @var list<float> */
|
||||
#[Field(type: Type::COLLECTION)]
|
||||
#[ODM\Field(type: Type::COLLECTION)]
|
||||
public array $plotEmbeddingVoyage3Large = [];
|
||||
|
||||
#[Field]
|
||||
#[ODM\Field]
|
||||
public string $category;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ to be designated as a document. This can be done through the
|
||||
|
||||
namespace Documents;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[Document]
|
||||
#[ODM\Document]
|
||||
class User
|
||||
{
|
||||
}
|
||||
@@ -88,9 +88,9 @@ option as follows:
|
||||
|
||||
namespace Documents;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[Document(db: 'my_db', collection: 'users')]
|
||||
#[ODM\Document(db: 'my_db', collection: 'users')]
|
||||
class User
|
||||
{
|
||||
}
|
||||
@@ -257,13 +257,12 @@ Here is an example:
|
||||
|
||||
namespace Documents;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[Document]
|
||||
#[ODM\Document]
|
||||
class User
|
||||
{
|
||||
#[Id]
|
||||
#[ODM\Id]
|
||||
public string $id;
|
||||
}
|
||||
|
||||
@@ -309,13 +308,12 @@ Here is an example how to manually set a string identifier for your documents:
|
||||
|
||||
namespace Documents;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[Document]
|
||||
#[ODM\Document]
|
||||
class MyPersistentClass
|
||||
{
|
||||
#[Id(strategy: 'NONE', type: 'string')]
|
||||
#[ODM\Id(strategy: 'NONE', type: 'string')]
|
||||
public string $id;
|
||||
|
||||
//...
|
||||
@@ -430,15 +428,14 @@ Example:
|
||||
|
||||
namespace Documents;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[Document]
|
||||
#[ODM\Document]
|
||||
class User
|
||||
{
|
||||
// ...
|
||||
|
||||
#[Field]
|
||||
#[ODM\Field]
|
||||
public string $username;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ the features.
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[ODM\MappedSuperclass]
|
||||
abstract class BaseEmployee
|
||||
|
||||
@@ -41,28 +41,27 @@ Mapping documents as GridFS files
|
||||
|
||||
namespace Documents;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\File;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[File(bucketName: 'image')]
|
||||
class Image
|
||||
{
|
||||
#[Id]
|
||||
#[ODM\Id]
|
||||
private ?string $id;
|
||||
|
||||
#[File\Filename]
|
||||
#[ODM\File\Filename]
|
||||
private ?string $name;
|
||||
|
||||
#[File\UploadDate]
|
||||
#[ODM\File\UploadDate]
|
||||
private \DateTimeInterface $uploadDate;
|
||||
|
||||
#[File\Length]
|
||||
#[ODM\File\Length]
|
||||
private ?int $length;
|
||||
|
||||
#[File\ChunkSize]
|
||||
#[ODM\File\ChunkSize]
|
||||
private ?int $chunkSize;
|
||||
|
||||
#[File\Metadata(targetDocument: ImageMetadata::class)]
|
||||
#[ODM\File\Metadata(targetDocument: ImageMetadata::class)]
|
||||
private ImageMetadata $metadata;
|
||||
|
||||
public function getId(): ?string
|
||||
@@ -131,13 +130,12 @@ The ``ImageMetadata`` class must be an embedded document:
|
||||
|
||||
namespace Documents;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbeddedDocument;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[EmbeddedDocument]
|
||||
#[ODM\EmbeddedDocument]
|
||||
class ImageMetadata
|
||||
{
|
||||
#[Field(type: 'string')]
|
||||
#[ODM\Field(type: 'string')]
|
||||
private string $contentType;
|
||||
|
||||
public function __construct(string $contentType)
|
||||
|
||||
@@ -86,7 +86,7 @@ You can provide your mapping information in Attribute or XML:
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
|
||||
|
||||
#[ODM\Document]
|
||||
class User
|
||||
|
||||
@@ -373,10 +373,10 @@ parameters:
|
||||
path: src/Iterator/IterableResult.php
|
||||
|
||||
-
|
||||
message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\Annotations\\SearchIndex\:\:__construct\(\) has parameter \$fields with no value type specified in iterable type array\.$#'
|
||||
message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\Attribute\\SearchIndex\:\:__construct\(\) has parameter \$fields with no value type specified in iterable type array\.$#'
|
||||
identifier: missingType.iterableValue
|
||||
count: 1
|
||||
path: src/Mapping/Annotations/SearchIndex.php
|
||||
path: src/Mapping/Attribute/SearchIndex.php
|
||||
|
||||
-
|
||||
message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata\:\:addInheritedAssociationMapping\(\) has Doctrine\\ODM\\MongoDB\\Mapping\\MappingException in PHPDoc @throws tag but it''s not thrown\.$#'
|
||||
@@ -475,7 +475,7 @@ parameters:
|
||||
path: src/Mapping/Driver/XmlDriver.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$mapping of method Doctrine\\ODM\\MongoDB\\Mapping\\Driver\\XmlDriver\:\:addFieldMapping\(\) expects array\{type\?\: string, fieldName\?\: string, name\?\: string, strategy\?\: string, association\?\: int, id\?\: bool, isOwningSide\?\: bool, collectionClass\?\: class\-string, \.\.\.\}, array\<string, array\<''contention''\|''max''\|''min''\|''precision''\|''queryType''\|''sparsity''\|''trimFactor''\|int\<0, max\>, Doctrine\\ODM\\MongoDB\\Mapping\\Annotations\\EncryptQuery\|float\|int\|MongoDB\\BSON\\Decimal128\|MongoDB\\BSON\\Int64\|MongoDB\\BSON\\UTCDateTime\|string\|null\>\|bool\|string\> given\.$#'
|
||||
message: '#^Parameter \#2 \$mapping of method Doctrine\\ODM\\MongoDB\\Mapping\\Driver\\XmlDriver\:\:addFieldMapping\(\) expects array\{type\?\: string, fieldName\?\: string, name\?\: string, strategy\?\: string, association\?\: int, id\?\: bool, isOwningSide\?\: bool, collectionClass\?\: class\-string, \.\.\.\}, array\<string, array\<''contention''\|''max''\|''min''\|''precision''\|''queryType''\|''sparsity''\|''trimFactor''\|int\<0, max\>, Doctrine\\ODM\\MongoDB\\Mapping\\EncryptQuery\|float\|int\|MongoDB\\BSON\\Decimal128\|MongoDB\\BSON\\Int64\|MongoDB\\BSON\\UTCDateTime\|string\|null\>\|bool\|string\> given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Mapping/Driver/XmlDriver.php
|
||||
|
||||
@@ -54,6 +54,10 @@ parameters:
|
||||
- message: '#MongoDB\\BSON\\VectorType#'
|
||||
- message: '#MongoDB\\BSON\\Binary\:\:(TYPE_VECTOR|getVectorType|toArray|fromVector)#'
|
||||
|
||||
- message: '#^Class Doctrine\\ODM\\MongoDB\\Mapping\\([a-zA-Z0-9\\]+) extends @final class Doctrine\\ODM\\MongoDB\\Mapping\\Attribute\\([a-zA-Z0-9\\]+)\.$#'
|
||||
identifier: class.extendsFinalByPhpDoc
|
||||
path: src/Mapping/Annotations/
|
||||
|
||||
# To be removed when reaching phpstan level 6
|
||||
checkMissingVarTagTypehint: true
|
||||
checkMissingTypehints: true
|
||||
|
||||
@@ -4,6 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
abstract class AbstractDocument implements Annotation
|
||||
{
|
||||
use function class_exists;
|
||||
|
||||
class_exists(\Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractDocument::class);
|
||||
|
||||
// @phpstan-ignore-next-line if.alwaysFalse
|
||||
if (false) {
|
||||
/** @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractDocument instead */
|
||||
abstract class AbstractDocument extends \Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractDocument
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,40 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
abstract class AbstractField implements Annotation
|
||||
{
|
||||
/** @var string|null */
|
||||
public $name;
|
||||
use function class_exists;
|
||||
|
||||
/** @var string|null */
|
||||
public $type;
|
||||
class_exists(\Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractField::class);
|
||||
|
||||
/** @var bool */
|
||||
public $nullable;
|
||||
|
||||
/** @var mixed[] */
|
||||
public $options;
|
||||
|
||||
/** @var string|null */
|
||||
public $strategy;
|
||||
|
||||
/** @var bool */
|
||||
public $notSaved;
|
||||
|
||||
/** @param mixed[] $options */
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
?string $type = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = null,
|
||||
bool $notSaved = false,
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->type = $type;
|
||||
$this->nullable = $nullable;
|
||||
$this->options = $options;
|
||||
$this->strategy = $strategy;
|
||||
$this->notSaved = $notSaved;
|
||||
// @phpstan-ignore-next-line if.alwaysFalse
|
||||
if (false) {
|
||||
/** @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractField instead */
|
||||
abstract class AbstractField extends \Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractField
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,56 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
abstract class AbstractIndex implements Annotation
|
||||
{
|
||||
/** @var string[] */
|
||||
public $keys;
|
||||
use function class_exists;
|
||||
|
||||
/** @var string|null */
|
||||
public $name;
|
||||
class_exists(\Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractIndex::class);
|
||||
|
||||
/** @var bool|null */
|
||||
public $background;
|
||||
|
||||
/** @var int|null */
|
||||
public $expireAfterSeconds;
|
||||
|
||||
/** @var bool */
|
||||
public $unique;
|
||||
|
||||
/** @var bool */
|
||||
public $sparse;
|
||||
|
||||
/** @var mixed[] */
|
||||
public $options;
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
public $partialFilterExpression;
|
||||
|
||||
/**
|
||||
* @param string[] $keys
|
||||
* @param string|int|null $order
|
||||
* @param mixed[] $options
|
||||
* @param array<string, mixed> $partialFilterExpression
|
||||
*/
|
||||
public function __construct(
|
||||
array $keys = [],
|
||||
?string $name = null,
|
||||
?bool $background = null,
|
||||
?int $expireAfterSeconds = null,
|
||||
public $order = null,
|
||||
bool $unique = false,
|
||||
bool $sparse = false,
|
||||
array $options = [],
|
||||
array $partialFilterExpression = [],
|
||||
) {
|
||||
$this->keys = $keys;
|
||||
$this->name = $name;
|
||||
$this->background = $background;
|
||||
$this->expireAfterSeconds = $expireAfterSeconds;
|
||||
$this->unique = $unique;
|
||||
$this->sparse = $sparse;
|
||||
$this->options = $options;
|
||||
$this->partialFilterExpression = $partialFilterExpression;
|
||||
// @phpstan-ignore-next-line if.alwaysFalse
|
||||
if (false) {
|
||||
/** @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractIndex instead */
|
||||
abstract class AbstractIndex extends \Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractIndex
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,18 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\AlsoLoad as AlsoLoadAttribute;
|
||||
|
||||
/**
|
||||
* Loads data from a different field if the original field is not set
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\AlsoLoad instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)]
|
||||
final class AlsoLoad implements Annotation
|
||||
final class AlsoLoad extends AlsoLoadAttribute implements Annotation
|
||||
{
|
||||
/** @param string|string[] $value */
|
||||
public function __construct(public $value, public ?string $name = null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
/** @deprecated Annotation classes are deprecated, {@see MappingAttribute} */
|
||||
interface Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,21 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\ChangeTrackingPolicy as ChangeTrackingPolicyAttribute;
|
||||
|
||||
/**
|
||||
* Specifies the change tracking policy for a document
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\ChangeTrackingPolicy instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class ChangeTrackingPolicy implements Annotation
|
||||
final class ChangeTrackingPolicy extends ChangeTrackingPolicyAttribute implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,22 +6,18 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\DefaultDiscriminatorValue as DefaultDiscriminatorValueAttribute;
|
||||
|
||||
/**
|
||||
* Specifies a default discriminator value to be used when the discriminator
|
||||
* field is not set in a document
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\DefaultDiscriminatorValue instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY)]
|
||||
final class DefaultDiscriminatorValue implements Annotation
|
||||
final class DefaultDiscriminatorValue extends DefaultDiscriminatorValueAttribute implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,21 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\DiscriminatorField as DiscriminatorFieldAttribute;
|
||||
|
||||
/**
|
||||
* Specify a field name to store a discriminator value
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\DiscriminatorField instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class DiscriminatorField implements Annotation
|
||||
final class DiscriminatorField extends DiscriminatorFieldAttribute implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,22 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\DiscriminatorMap as DiscriminatorMapAttribute;
|
||||
|
||||
/**
|
||||
* Specify a map of discriminator values and classes
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\DiscriminatorMap instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY)]
|
||||
final class DiscriminatorMap implements Annotation
|
||||
final class DiscriminatorMap extends DiscriminatorMapAttribute implements Annotation
|
||||
{
|
||||
/** @var array<class-string> */
|
||||
public $value;
|
||||
|
||||
/** @param array<class-string> $value */
|
||||
public function __construct(array $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,21 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\DiscriminatorValue as DiscriminatorValueAttribute;
|
||||
|
||||
/**
|
||||
* Use the specified discriminator for this class
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\DiscriminatorValue instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class DiscriminatorValue implements Annotation
|
||||
final class DiscriminatorValue extends DiscriminatorValueAttribute implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,49 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\Document as DocumentAttribute;
|
||||
|
||||
/**
|
||||
* Identifies a class as a document that can be stored in the database
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\Document instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class Document extends AbstractDocument
|
||||
final class Document extends DocumentAttribute implements Annotation
|
||||
{
|
||||
/** @var string|null */
|
||||
public $db;
|
||||
|
||||
/** @var string|null */
|
||||
public $repositoryClass;
|
||||
|
||||
/** @var Index[] */
|
||||
public $indexes;
|
||||
|
||||
/** @var bool */
|
||||
public $readOnly;
|
||||
|
||||
/** @var string|null */
|
||||
public $shardKey;
|
||||
|
||||
/**
|
||||
* @param string|array{name: string, capped?: bool, size?: int, max?: int}|null $collection
|
||||
* @param Index[] $indexes
|
||||
* @param int|string|null $writeConcern
|
||||
*/
|
||||
public function __construct(
|
||||
?string $db = null,
|
||||
public $collection = null,
|
||||
?string $repositoryClass = null,
|
||||
array $indexes = [],
|
||||
bool $readOnly = false,
|
||||
?string $shardKey = null,
|
||||
public $writeConcern = null,
|
||||
) {
|
||||
$this->db = $db;
|
||||
$this->repositoryClass = $repositoryClass;
|
||||
$this->indexes = $indexes;
|
||||
$this->readOnly = $readOnly;
|
||||
$this->shardKey = $shardKey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,60 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
use Doctrine\ODM\MongoDB\Utility\CollectionHelper;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\EmbedMany as EmbedManyAttribute;
|
||||
|
||||
/**
|
||||
* Embeds multiple documents
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\EmbedMany instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class EmbedMany extends AbstractField
|
||||
final class EmbedMany extends EmbedManyAttribute implements Annotation
|
||||
{
|
||||
/** @var bool */
|
||||
public $embedded = true;
|
||||
|
||||
/** @var string|null */
|
||||
public $targetDocument;
|
||||
|
||||
/** @var string|null */
|
||||
public $discriminatorField;
|
||||
|
||||
/** @var array<string, class-string>|null */
|
||||
public $discriminatorMap;
|
||||
|
||||
/** @var string|null */
|
||||
public $defaultDiscriminatorValue;
|
||||
|
||||
/** @var string|null */
|
||||
public $collectionClass;
|
||||
|
||||
/** @var bool */
|
||||
public $storeEmptyArray;
|
||||
|
||||
/** @param array<string, class-string>|null $discriminatorMap */
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
string $strategy = CollectionHelper::DEFAULT_STRATEGY,
|
||||
bool $notSaved = false,
|
||||
?string $targetDocument = null,
|
||||
?string $discriminatorField = null,
|
||||
?array $discriminatorMap = null,
|
||||
?string $defaultDiscriminatorValue = null,
|
||||
?string $collectionClass = null,
|
||||
bool $storeEmptyArray = false,
|
||||
) {
|
||||
parent::__construct($name, ClassMetadata::MANY, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->targetDocument = $targetDocument;
|
||||
$this->discriminatorField = $discriminatorField;
|
||||
$this->discriminatorMap = $discriminatorMap;
|
||||
$this->defaultDiscriminatorValue = $defaultDiscriminatorValue;
|
||||
$this->collectionClass = $collectionClass;
|
||||
$this->storeEmptyArray = $storeEmptyArray;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,49 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\EmbedOne as EmbedOneAttribute;
|
||||
|
||||
/**
|
||||
* Embeds a single document
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\EmbedOne instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class EmbedOne extends AbstractField
|
||||
final class EmbedOne extends EmbedOneAttribute implements Annotation
|
||||
{
|
||||
/** @var bool */
|
||||
public $embedded = true;
|
||||
|
||||
/** @var string|null */
|
||||
public $targetDocument;
|
||||
|
||||
/** @var string|null */
|
||||
public $discriminatorField;
|
||||
|
||||
/** @var array<string, class-string>|null */
|
||||
public $discriminatorMap;
|
||||
|
||||
/** @var string|null */
|
||||
public $defaultDiscriminatorValue;
|
||||
|
||||
/** @param array<string, class-string>|null $discriminatorMap */
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = null,
|
||||
bool $notSaved = false,
|
||||
?string $targetDocument = null,
|
||||
?string $discriminatorField = null,
|
||||
?array $discriminatorMap = null,
|
||||
?string $defaultDiscriminatorValue = null,
|
||||
) {
|
||||
parent::__construct($name, ClassMetadata::ONE, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->targetDocument = $targetDocument;
|
||||
$this->discriminatorField = $discriminatorField;
|
||||
$this->discriminatorMap = $discriminatorMap;
|
||||
$this->defaultDiscriminatorValue = $defaultDiscriminatorValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,22 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\EmbeddedDocument as EmbeddedDocumentAttribute;
|
||||
|
||||
/**
|
||||
* Identifies a class as a document that can be embedded but not stored by itself
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\EmbeddedDocument instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class EmbeddedDocument extends AbstractDocument
|
||||
final class EmbeddedDocument extends EmbeddedDocumentAttribute implements Annotation
|
||||
{
|
||||
/** @var Index[] */
|
||||
public $indexes;
|
||||
|
||||
/** @param Index[] $indexes */
|
||||
public function __construct(array $indexes = [])
|
||||
{
|
||||
$this->indexes = $indexes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,43 +5,20 @@ declare(strict_types=1);
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use MongoDB\BSON\Decimal128;
|
||||
use MongoDB\BSON\Int64;
|
||||
use MongoDB\BSON\UTCDateTime;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\Encrypt as EncryptAttribute;
|
||||
|
||||
/**
|
||||
* Defines an encrypted field mapping.
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\Encrypt instead
|
||||
*
|
||||
* @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/encrypt-and-query/#configure-encrypted-fields-for-optimal-search-and-storage
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY)]
|
||||
final class Encrypt implements Annotation
|
||||
final class Encrypt extends EncryptAttribute implements Annotation
|
||||
{
|
||||
public int|float|Int64|Decimal128|UTCDateTime|null $min;
|
||||
public int|float|Int64|Decimal128|UTCDateTime|null $max;
|
||||
|
||||
/**
|
||||
* @param EncryptQuery|null $queryType Set the query type for the field, null if not queryable.
|
||||
* @param int<1, 4>|null $sparsity
|
||||
* @param positive-int|null $precision
|
||||
* @param positive-int|null $trimFactor
|
||||
* @param positive-int|null $contention
|
||||
*/
|
||||
public function __construct(
|
||||
public ?EncryptQuery $queryType = null,
|
||||
int|float|Int64|Decimal128|UTCDateTime|DateTimeInterface|null $min = null,
|
||||
int|float|Int64|Decimal128|UTCDateTime|DateTimeInterface|null $max = null,
|
||||
public ?int $sparsity = null,
|
||||
public ?int $precision = null,
|
||||
public ?int $trimFactor = null,
|
||||
public ?int $contention = null,
|
||||
) {
|
||||
$this->min = $min instanceof DateTimeInterface ? new UTCDateTime($min) : $min;
|
||||
$this->max = $max instanceof DateTimeInterface ? new UTCDateTime($max) : $max;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use MongoDB\Driver\ClientEncryption;
|
||||
use Doctrine\ODM\MongoDB\Mapping\EncryptQuery;
|
||||
|
||||
enum EncryptQuery: string
|
||||
{
|
||||
case Equality = ClientEncryption::QUERY_TYPE_EQUALITY;
|
||||
case Range = ClientEncryption::QUERY_TYPE_RANGE;
|
||||
}
|
||||
use function class_exists;
|
||||
use function trigger_deprecation;
|
||||
|
||||
trigger_deprecation('doctrine/mongodb-odm', '2.16', 'Enum %s\\EncryptQuery is deprecated, use %s instead.', __NAMESPACE__, EncryptQuery::class);
|
||||
|
||||
class_exists(EncryptQuery::class);
|
||||
|
||||
@@ -5,36 +5,18 @@ declare(strict_types=1);
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use BackedEnum;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\Field as FieldAttribute;
|
||||
|
||||
/**
|
||||
* Specifies a generic field mapping
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\Field instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class Field extends AbstractField
|
||||
final class Field extends FieldAttribute implements Annotation
|
||||
{
|
||||
/** @var class-string<BackedEnum>|null */
|
||||
public $enumType;
|
||||
|
||||
/**
|
||||
* @param mixed[] $options
|
||||
* @param class-string<BackedEnum>|null $enumType
|
||||
*/
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
?string $type = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = null,
|
||||
bool $notSaved = false,
|
||||
?string $enumType = null,
|
||||
) {
|
||||
parent::__construct($name, $type, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->enumType = $enumType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,57 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\File as FileAttribute;
|
||||
|
||||
/**
|
||||
* Identifies a class as a GridFS file that can be stored in the database
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\File instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class File extends AbstractDocument
|
||||
final class File extends FileAttribute implements Annotation
|
||||
{
|
||||
/** @var string|null */
|
||||
public $db;
|
||||
|
||||
/** @var string|null */
|
||||
public $bucketName;
|
||||
|
||||
/** @var string|null */
|
||||
public $repositoryClass;
|
||||
|
||||
/** @var Index[] */
|
||||
public $indexes;
|
||||
|
||||
/** @var bool bool */
|
||||
public $readOnly;
|
||||
|
||||
/** @var string|null */
|
||||
public $shardKey;
|
||||
|
||||
/** @var int|null */
|
||||
public $chunkSizeBytes;
|
||||
|
||||
/**
|
||||
* @param Index[] $indexes
|
||||
* @param string|int|null $writeConcern
|
||||
*/
|
||||
public function __construct(
|
||||
?string $db = null,
|
||||
?string $bucketName = null,
|
||||
?string $repositoryClass = null,
|
||||
array $indexes = [],
|
||||
bool $readOnly = false,
|
||||
?string $shardKey = null,
|
||||
public $writeConcern = null,
|
||||
?int $chunkSizeBytes = null,
|
||||
) {
|
||||
$this->db = $db;
|
||||
$this->bucketName = $bucketName;
|
||||
$this->repositoryClass = $repositoryClass;
|
||||
$this->indexes = $indexes;
|
||||
$this->readOnly = $readOnly;
|
||||
$this->shardKey = $shardKey;
|
||||
$this->chunkSizeBytes = $chunkSizeBytes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,16 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Annotation;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\File\ChunkSize as ChunkSizeAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\File\ChunkSize instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class ChunkSize extends AbstractField
|
||||
final class ChunkSize extends ChunkSizeAttribute implements Annotation
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('chunkSize', 'int', false, [], null, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,16 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Annotation;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\File\Filename as FilenameAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\File\Filename instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class Filename extends AbstractField
|
||||
final class Filename extends FilenameAttribute implements Annotation
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('filename', 'string', false, [], null, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,16 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Annotation;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\File\Length as LengthAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\File\Length instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class Length extends AbstractField
|
||||
final class Length extends LengthAttribute implements Annotation
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('length', 'int', false, [], null, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,47 +6,16 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Annotation;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\File\Metadata as MetadataAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\File\Metadata instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class Metadata extends AbstractField
|
||||
final class Metadata extends MetadataAttribute implements Annotation
|
||||
{
|
||||
/** @var bool */
|
||||
public $embedded = true;
|
||||
|
||||
/** @var string|null */
|
||||
public $targetDocument;
|
||||
|
||||
/** @var string|null */
|
||||
public $discriminatorField;
|
||||
|
||||
/** @var array<string, class-string>|null */
|
||||
public $discriminatorMap;
|
||||
|
||||
/** @var string|null */
|
||||
public $defaultDiscriminatorValue;
|
||||
|
||||
/** @param array<string, class-string>|null $discriminatorMap */
|
||||
public function __construct(
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = null,
|
||||
bool $notSaved = false,
|
||||
?string $targetDocument = null,
|
||||
?string $discriminatorField = null,
|
||||
?array $discriminatorMap = null,
|
||||
?string $defaultDiscriminatorValue = null,
|
||||
) {
|
||||
parent::__construct('metadata', ClassMetadata::ONE, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->targetDocument = $targetDocument;
|
||||
$this->discriminatorField = $discriminatorField;
|
||||
$this->discriminatorMap = $discriminatorMap;
|
||||
$this->defaultDiscriminatorValue = $defaultDiscriminatorValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,16 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Annotation;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\File\UploadDate as UploadDateAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\File\UploadDate instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class UploadDate extends AbstractField
|
||||
final class UploadDate extends UploadDateAttribute implements Annotation
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('uploadDate', 'date', false, [], null, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,17 @@ declare(strict_types=1);
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\HasLifecycleCallbacks as HasLifecycleCallbacksAttribute;
|
||||
|
||||
/**
|
||||
* Must be set on a document class to instruct Doctrine to check for lifecycle
|
||||
* callback annotations on public methods.
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\HasLifecycleCallbacks instead
|
||||
*
|
||||
* @Annotation
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class HasLifecycleCallbacks implements Annotation
|
||||
final class HasLifecycleCallbacks extends HasLifecycleCallbacksAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,27 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\Id as IdAttribute;
|
||||
|
||||
/**
|
||||
* Special field mapping to map document identifiers
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\Id instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class Id extends AbstractField
|
||||
final class Id extends IdAttribute implements Annotation
|
||||
{
|
||||
/** @var bool */
|
||||
public $id = true;
|
||||
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
?string $type = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = 'auto',
|
||||
bool $notSaved = false,
|
||||
) {
|
||||
parent::__construct($name, $type, $nullable, $options, $strategy, $notSaved);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\Index as IndexAttribute;
|
||||
|
||||
/**
|
||||
* Defines an index on a field
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\Index instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
|
||||
final class Index extends AbstractIndex
|
||||
final class Index extends IndexAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,21 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\InheritanceType as InheritanceTypeAttribute;
|
||||
|
||||
/**
|
||||
* Specifies which inheritance type to use for a document
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\InheritanceType instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class InheritanceType implements Annotation
|
||||
final class InheritanceType extends InheritanceTypeAttribute implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,16 @@ declare(strict_types=1);
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\Lock as LockAttribute;
|
||||
|
||||
/**
|
||||
* Specifies a field to use for pessimistic locking
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\Lock instead
|
||||
*
|
||||
* @Annotation
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class Lock implements Annotation
|
||||
final class Lock extends LockAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,26 +6,18 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\MappedSuperclass as MappedSuperclassAttribute;
|
||||
|
||||
/**
|
||||
* Specifies a parent class that other documents may extend to inherit mapping
|
||||
* information
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\MappedSuperclass instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class MappedSuperclass extends AbstractDocument
|
||||
final class MappedSuperclass extends MappedSuperclassAttribute implements Annotation
|
||||
{
|
||||
/** @var string|null */
|
||||
public $repositoryClass;
|
||||
|
||||
/** @var string|null */
|
||||
public $collection;
|
||||
|
||||
public function __construct(?string $repositoryClass = null, ?string $collection = null)
|
||||
{
|
||||
$this->repositoryClass = $repositoryClass;
|
||||
$this->collection = $collection;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\PostLoad as PostLoadAttribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a postLoad lifecycle callback
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\PostLoad instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class PostLoad implements Annotation
|
||||
final class PostLoad extends PostLoadAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\PostPersist as PostPersistAttribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a postPersist lifecycle callback
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\PostPersist instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class PostPersist implements Annotation
|
||||
final class PostPersist extends PostPersistAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\PostRemove as PostRemoveAttribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a postRemove lifecycle callback
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\PostRemove instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class PostRemove implements Annotation
|
||||
final class PostRemove extends PostRemoveAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\PostUpdate as PostUpdateAttribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a postUpdate lifecycle callback
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\PostUpdate instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class PostUpdate implements Annotation
|
||||
final class PostUpdate extends PostUpdateAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\PreFlush as PreFlushAttribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a preFlush lifecycle callback
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\PreFlush instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class PreFlush implements Annotation
|
||||
final class PreFlush extends PreFlushAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\PreLoad as PreLoadAttribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a preLoad lifecycle callback
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\PreLoad instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class PreLoad implements Annotation
|
||||
final class PreLoad extends PreLoadAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\PrePersist as PrePersistAttribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a prePersist lifecycle callback
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\PrePersist instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class PrePersist implements Annotation
|
||||
final class PrePersist extends PrePersistAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\PreRemove as PreRemoveAttribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a preRemove lifecycle callback
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\PreRemove instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class PreRemove implements Annotation
|
||||
final class PreRemove extends PreRemoveAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\PreUpdate as PreUpdateAttribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a preUpdate lifecycle callback
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\PreUpdate instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class PreUpdate implements Annotation
|
||||
final class PreUpdate extends PreUpdateAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,12 +6,15 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\QueryResultDocument as QueryResultDocumentAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\QueryResultDocument instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class QueryResultDocument extends AbstractDocument
|
||||
final class QueryResultDocument extends QueryResultDocumentAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,24 +6,15 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\ReadPreference as ReadPreferenceAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\ReadPreference instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class ReadPreference implements Annotation
|
||||
final class ReadPreference extends ReadPreferenceAttribute implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
/** @var string[][]|null */
|
||||
public $tags;
|
||||
|
||||
/** @param string[][]|null $tags */
|
||||
public function __construct(string $value, ?array $tags = null)
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->tags = $tags;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,117 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
use Doctrine\ODM\MongoDB\Utility\CollectionHelper;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\ReferenceMany as ReferenceManyAttribute;
|
||||
|
||||
/**
|
||||
* Specifies a one-to-many relationship to a different document
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\ReferenceMany instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class ReferenceMany extends AbstractField
|
||||
final class ReferenceMany extends ReferenceManyAttribute implements Annotation
|
||||
{
|
||||
/** @var bool */
|
||||
public $reference = true;
|
||||
|
||||
/** @var string */
|
||||
public $storeAs;
|
||||
|
||||
/** @var string|null */
|
||||
public $targetDocument;
|
||||
|
||||
/** @var string|null */
|
||||
public $discriminatorField;
|
||||
|
||||
/** @var array<string, class-string>|null */
|
||||
public $discriminatorMap;
|
||||
|
||||
/** @var string|null */
|
||||
public $defaultDiscriminatorValue;
|
||||
|
||||
/** @var bool|null */
|
||||
public $orphanRemoval;
|
||||
|
||||
/** @var string|null */
|
||||
public $inversedBy;
|
||||
|
||||
/** @var string|null */
|
||||
public $mappedBy;
|
||||
|
||||
/** @var string|null */
|
||||
public $repositoryMethod;
|
||||
|
||||
/** @var array<string, string|int> */
|
||||
public $sort;
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
public $criteria;
|
||||
|
||||
/** @var int|null */
|
||||
public $limit;
|
||||
|
||||
/** @var int|null */
|
||||
public $skip;
|
||||
|
||||
/** @var string|null */
|
||||
public $collectionClass;
|
||||
|
||||
/** @var string[] */
|
||||
public $prime;
|
||||
|
||||
/** @var bool */
|
||||
public $storeEmptyArray;
|
||||
|
||||
/**
|
||||
* @param array<string, class-string>|null $discriminatorMap
|
||||
* @param string[]|string|null $cascade
|
||||
* @param array<string, string|int> $sort
|
||||
* @param array<string, mixed> $criteria
|
||||
* @param string[] $prime
|
||||
*/
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
string $strategy = CollectionHelper::DEFAULT_STRATEGY,
|
||||
bool $notSaved = false,
|
||||
string $storeAs = ClassMetadata::REFERENCE_STORE_AS_DB_REF,
|
||||
?string $targetDocument = null,
|
||||
?string $discriminatorField = null,
|
||||
?array $discriminatorMap = null,
|
||||
?string $defaultDiscriminatorValue = null,
|
||||
public $cascade = null,
|
||||
?bool $orphanRemoval = null,
|
||||
?string $inversedBy = null,
|
||||
?string $mappedBy = null,
|
||||
?string $repositoryMethod = null,
|
||||
array $sort = [],
|
||||
array $criteria = [],
|
||||
?int $limit = null,
|
||||
?int $skip = null,
|
||||
?string $collectionClass = null,
|
||||
array $prime = [],
|
||||
bool $storeEmptyArray = false,
|
||||
) {
|
||||
parent::__construct($name, ClassMetadata::MANY, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->storeAs = $storeAs;
|
||||
$this->targetDocument = $targetDocument;
|
||||
$this->discriminatorField = $discriminatorField;
|
||||
$this->discriminatorMap = $discriminatorMap;
|
||||
$this->defaultDiscriminatorValue = $defaultDiscriminatorValue;
|
||||
$this->orphanRemoval = $orphanRemoval;
|
||||
$this->inversedBy = $inversedBy;
|
||||
$this->mappedBy = $mappedBy;
|
||||
$this->repositoryMethod = $repositoryMethod;
|
||||
$this->sort = $sort;
|
||||
$this->criteria = $criteria;
|
||||
$this->limit = $limit;
|
||||
$this->skip = $skip;
|
||||
$this->collectionClass = $collectionClass;
|
||||
$this->prime = $prime;
|
||||
$this->storeEmptyArray = $storeEmptyArray;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,101 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\ReferenceOne as ReferenceOneAttribute;
|
||||
|
||||
/**
|
||||
* Specifies a one-to-one relationship to a different document
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\ReferenceOne instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class ReferenceOne extends AbstractField
|
||||
final class ReferenceOne extends ReferenceOneAttribute implements Annotation
|
||||
{
|
||||
/** @var bool */
|
||||
public $reference = true;
|
||||
|
||||
/** @var string */
|
||||
public $storeAs;
|
||||
|
||||
/** @var class-string|null */
|
||||
public $targetDocument;
|
||||
|
||||
/** @var string|null */
|
||||
public $discriminatorField;
|
||||
|
||||
/** @var array<string, class-string>|null */
|
||||
public $discriminatorMap;
|
||||
|
||||
/** @var string|null */
|
||||
public $defaultDiscriminatorValue;
|
||||
|
||||
/** @var bool|null */
|
||||
public $orphanRemoval;
|
||||
|
||||
/** @var string|null */
|
||||
public $inversedBy;
|
||||
|
||||
/** @var string|null */
|
||||
public $mappedBy;
|
||||
|
||||
/** @var string|null */
|
||||
public $repositoryMethod;
|
||||
|
||||
/** @var array<string, string|int> */
|
||||
public $sort;
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
public $criteria;
|
||||
|
||||
/** @var int|null */
|
||||
public $limit;
|
||||
|
||||
/** @var int|null */
|
||||
public $skip;
|
||||
|
||||
/**
|
||||
* @param class-string|null $targetDocument
|
||||
* @param array<string, class-string>|null $discriminatorMap
|
||||
* @param string[]|string|null $cascade
|
||||
* @param array<string, string|int> $sort
|
||||
* @param array<string, mixed> $criteria
|
||||
*/
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = null,
|
||||
bool $notSaved = false,
|
||||
string $storeAs = ClassMetadata::REFERENCE_STORE_AS_DB_REF,
|
||||
?string $targetDocument = null,
|
||||
?string $discriminatorField = null,
|
||||
?array $discriminatorMap = null,
|
||||
?string $defaultDiscriminatorValue = null,
|
||||
public $cascade = null,
|
||||
?bool $orphanRemoval = null,
|
||||
?string $inversedBy = null,
|
||||
?string $mappedBy = null,
|
||||
?string $repositoryMethod = null,
|
||||
array $sort = [],
|
||||
array $criteria = [],
|
||||
?int $limit = null,
|
||||
?int $skip = null,
|
||||
) {
|
||||
parent::__construct($name, ClassMetadata::ONE, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->storeAs = $storeAs;
|
||||
$this->targetDocument = $targetDocument;
|
||||
$this->discriminatorField = $discriminatorField;
|
||||
$this->discriminatorMap = $discriminatorMap;
|
||||
$this->defaultDiscriminatorValue = $defaultDiscriminatorValue;
|
||||
$this->orphanRemoval = $orphanRemoval;
|
||||
$this->inversedBy = $inversedBy;
|
||||
$this->mappedBy = $mappedBy;
|
||||
$this->repositoryMethod = $repositoryMethod;
|
||||
$this->sort = $sort;
|
||||
$this->criteria = $criteria;
|
||||
$this->limit = $limit;
|
||||
$this->skip = $skip;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,14 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\SearchIndex as SearchIndexAttribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
|
||||
/**
|
||||
* Defines a search index on a class.
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\SearchIndex instead
|
||||
*
|
||||
* @see https://www.mongodb.com/docs/atlas/atlas-search/index-definitions/
|
||||
*
|
||||
* @Annotation
|
||||
@@ -19,23 +22,6 @@ use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
* @phpstan-import-type SearchIndexSynonym from ClassMetadata
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
|
||||
class SearchIndex implements Annotation
|
||||
final class SearchIndex extends SearchIndexAttribute implements Annotation
|
||||
{
|
||||
/**
|
||||
* @param array<string, array>|null $fields
|
||||
* @param list<array>|null $analyzers
|
||||
* @param SearchIndexStoredSource|null $storedSource
|
||||
* @param list<SearchIndexSynonym>|null $synonyms
|
||||
*/
|
||||
public function __construct(
|
||||
public ?string $name = null,
|
||||
public ?bool $dynamic = null,
|
||||
public ?array $fields = null,
|
||||
public ?string $analyzer = null,
|
||||
public ?string $searchAnalyzer = null,
|
||||
public ?array $analyzers = null,
|
||||
public $storedSource = null,
|
||||
public ?array $synonyms = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,28 +6,15 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\ShardKey as ShardKeyAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\ShardKey instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class ShardKey implements Annotation
|
||||
final class ShardKey extends ShardKeyAttribute implements Annotation
|
||||
{
|
||||
/** @var string[] */
|
||||
public $keys;
|
||||
|
||||
/** @var bool|null */
|
||||
public $unique;
|
||||
|
||||
/** @var int|null */
|
||||
public $numInitialChunks;
|
||||
|
||||
/** @param string[] $keys */
|
||||
public function __construct(array $keys = [], ?bool $unique = null, ?int $numInitialChunks = null)
|
||||
{
|
||||
$this->keys = $keys;
|
||||
$this->unique = $unique;
|
||||
$this->numInitialChunks = $numInitialChunks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,24 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\TimeSeries\Granularity;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\TimeSeries as TimeSeriesAttribute;
|
||||
|
||||
/**
|
||||
* Marks a document or superclass as a time series document
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\TimeSeries instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class TimeSeries implements Annotation
|
||||
final class TimeSeries extends TimeSeriesAttribute implements Annotation
|
||||
{
|
||||
public function __construct(
|
||||
public readonly string $timeField,
|
||||
public readonly ?string $metaField = null,
|
||||
public readonly ?Granularity $granularity = null,
|
||||
public readonly ?int $expireAfterSeconds = null,
|
||||
public readonly ?int $bucketMaxSpanSeconds = null,
|
||||
public readonly ?int $bucketRoundingSeconds = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,36 +6,17 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\UniqueIndex as UniqueIndexAttribute;
|
||||
|
||||
/**
|
||||
* Specifies a unique index on a field
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\UniqueIndex instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
|
||||
final class UniqueIndex extends AbstractIndex
|
||||
final class UniqueIndex extends UniqueIndexAttribute implements Annotation
|
||||
{
|
||||
public function __construct(
|
||||
array $keys = [],
|
||||
?string $name = null,
|
||||
?bool $background = null,
|
||||
?int $expireAfterSeconds = null,
|
||||
$order = null,
|
||||
bool $sparse = false,
|
||||
array $options = [],
|
||||
array $partialFilterExpression = [],
|
||||
) {
|
||||
parent::__construct(
|
||||
$keys,
|
||||
$name,
|
||||
$background,
|
||||
$expireAfterSeconds,
|
||||
$order,
|
||||
true,
|
||||
$sparse,
|
||||
$options,
|
||||
$partialFilterExpression,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,42 +6,16 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\Validation as ValidationAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\Validation instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Validation implements Annotation
|
||||
final class Validation extends ValidationAttribute implements Annotation
|
||||
{
|
||||
/** @var string|null */
|
||||
public $validator;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
* @Enum({
|
||||
* ClassMetadata::SCHEMA_VALIDATION_ACTION_ERROR,
|
||||
* ClassMetadata::SCHEMA_VALIDATION_ACTION_WARN,
|
||||
* })
|
||||
*/
|
||||
public $action;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
* @Enum({
|
||||
* ClassMetadata::SCHEMA_VALIDATION_LEVEL_OFF,
|
||||
* ClassMetadata::SCHEMA_VALIDATION_LEVEL_STRICT,
|
||||
* ClassMetadata::SCHEMA_VALIDATION_LEVEL_MODERATE,
|
||||
* })
|
||||
*/
|
||||
public $level;
|
||||
|
||||
public function __construct(?string $validator = null, ?string $action = null, ?string $level = null)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
$this->action = $action;
|
||||
$this->level = $level;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,14 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\VectorSearchIndex as VectorSearchIndexAttribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
|
||||
/**
|
||||
* Defines a vector search index on a class.
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\VectorSearchIndex instead
|
||||
*
|
||||
* @see https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/
|
||||
*
|
||||
* @Annotation
|
||||
@@ -18,12 +21,6 @@ use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
* @phpstan-import-type VectorSearchIndexField from ClassMetadata
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
|
||||
class VectorSearchIndex implements Annotation
|
||||
final class VectorSearchIndex extends VectorSearchIndexAttribute implements Annotation
|
||||
{
|
||||
/** @param list<VectorSearchIndexField> $fields */
|
||||
public function __construct(
|
||||
public array $fields,
|
||||
public ?string $name = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,16 @@ declare(strict_types=1);
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\Version as VersionAttribute;
|
||||
|
||||
/**
|
||||
* Specifies a field to use for optimistic locking
|
||||
*
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\Version instead
|
||||
*
|
||||
* @Annotation
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class Version implements Annotation
|
||||
final class Version extends VersionAttribute implements Annotation
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,35 +6,15 @@ namespace Doctrine\ODM\MongoDB\Mapping\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\View as ViewAttribute;
|
||||
|
||||
/**
|
||||
* @deprecated Use \Doctrine\ODM\MongoDB\Mapping\Attribute\View instead
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class View extends AbstractDocument
|
||||
final class View extends ViewAttribute implements Annotation
|
||||
{
|
||||
/** @var string|null */
|
||||
public $db;
|
||||
|
||||
/** @var string|null */
|
||||
public $view;
|
||||
|
||||
/** @var string|null */
|
||||
public $rootClass;
|
||||
|
||||
/** @var string|null */
|
||||
public $repositoryClass;
|
||||
|
||||
public function __construct(
|
||||
?string $db = null,
|
||||
?string $view = null,
|
||||
?string $rootClass = null,
|
||||
?string $repositoryClass = null,
|
||||
) {
|
||||
$this->db = $db;
|
||||
$this->view = $view;
|
||||
$this->rootClass = $rootClass;
|
||||
$this->repositoryClass = $repositoryClass;
|
||||
}
|
||||
}
|
||||
|
||||
15
src/Mapping/Attribute/AbstractDocument.php
Normal file
15
src/Mapping/Attribute/AbstractDocument.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use function class_alias;
|
||||
|
||||
/** @internal */
|
||||
abstract class AbstractDocument implements MappingAttribute
|
||||
{
|
||||
}
|
||||
|
||||
// @phpstan-ignore class.notFound
|
||||
class_alias(AbstractDocument::class, \Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractDocument::class);
|
||||
49
src/Mapping/Attribute/AbstractField.php
Normal file
49
src/Mapping/Attribute/AbstractField.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use function class_alias;
|
||||
|
||||
/** @internal */
|
||||
abstract class AbstractField
|
||||
{
|
||||
/** @var string|null */
|
||||
public $name;
|
||||
|
||||
/** @var string|null */
|
||||
public $type;
|
||||
|
||||
/** @var bool */
|
||||
public $nullable;
|
||||
|
||||
/** @var mixed[] */
|
||||
public $options;
|
||||
|
||||
/** @var string|null */
|
||||
public $strategy;
|
||||
|
||||
/** @var bool */
|
||||
public $notSaved;
|
||||
|
||||
/** @param mixed[] $options */
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
?string $type = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = null,
|
||||
bool $notSaved = false,
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->type = $type;
|
||||
$this->nullable = $nullable;
|
||||
$this->options = $options;
|
||||
$this->strategy = $strategy;
|
||||
$this->notSaved = $notSaved;
|
||||
}
|
||||
}
|
||||
|
||||
// @phpstan-ignore class.notFound
|
||||
class_alias(AbstractField::class, \Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractField::class);
|
||||
65
src/Mapping/Attribute/AbstractIndex.php
Normal file
65
src/Mapping/Attribute/AbstractIndex.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use function class_alias;
|
||||
|
||||
/** @internal */
|
||||
abstract class AbstractIndex
|
||||
{
|
||||
/** @var string[] */
|
||||
public $keys;
|
||||
|
||||
/** @var string|null */
|
||||
public $name;
|
||||
|
||||
/** @var bool|null */
|
||||
public $background;
|
||||
|
||||
/** @var int|null */
|
||||
public $expireAfterSeconds;
|
||||
|
||||
/** @var bool */
|
||||
public $unique;
|
||||
|
||||
/** @var bool */
|
||||
public $sparse;
|
||||
|
||||
/** @var mixed[] */
|
||||
public $options;
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
public $partialFilterExpression;
|
||||
|
||||
/**
|
||||
* @param string[] $keys
|
||||
* @param string|int|null $order
|
||||
* @param mixed[] $options
|
||||
* @param array<string, mixed> $partialFilterExpression
|
||||
*/
|
||||
public function __construct(
|
||||
array $keys = [],
|
||||
?string $name = null,
|
||||
?bool $background = null,
|
||||
?int $expireAfterSeconds = null,
|
||||
public $order = null,
|
||||
bool $unique = false,
|
||||
bool $sparse = false,
|
||||
array $options = [],
|
||||
array $partialFilterExpression = [],
|
||||
) {
|
||||
$this->keys = $keys;
|
||||
$this->name = $name;
|
||||
$this->background = $background;
|
||||
$this->expireAfterSeconds = $expireAfterSeconds;
|
||||
$this->unique = $unique;
|
||||
$this->sparse = $sparse;
|
||||
$this->options = $options;
|
||||
$this->partialFilterExpression = $partialFilterExpression;
|
||||
}
|
||||
}
|
||||
|
||||
// @phpstan-ignore class.notFound
|
||||
class_alias(AbstractIndex::class, \Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractIndex::class);
|
||||
21
src/Mapping/Attribute/AlsoLoad.php
Normal file
21
src/Mapping/Attribute/AlsoLoad.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Loads data from a different field if the original field is not set
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)]
|
||||
class AlsoLoad implements MappingAttribute
|
||||
{
|
||||
/** @param string|string[] $value */
|
||||
public function __construct(public $value, public ?string $name = null)
|
||||
{
|
||||
}
|
||||
}
|
||||
24
src/Mapping/Attribute/ChangeTrackingPolicy.php
Normal file
24
src/Mapping/Attribute/ChangeTrackingPolicy.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Specifies the change tracking policy for a document
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class ChangeTrackingPolicy implements MappingAttribute
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
25
src/Mapping/Attribute/DefaultDiscriminatorValue.php
Normal file
25
src/Mapping/Attribute/DefaultDiscriminatorValue.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Specifies a default discriminator value to be used when the discriminator
|
||||
* field is not set in a document
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY)]
|
||||
class DefaultDiscriminatorValue implements MappingAttribute
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
24
src/Mapping/Attribute/DiscriminatorField.php
Normal file
24
src/Mapping/Attribute/DiscriminatorField.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Specify a field name to store a discriminator value
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class DiscriminatorField implements MappingAttribute
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
25
src/Mapping/Attribute/DiscriminatorMap.php
Normal file
25
src/Mapping/Attribute/DiscriminatorMap.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Specify a map of discriminator values and classes
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY)]
|
||||
class DiscriminatorMap implements MappingAttribute
|
||||
{
|
||||
/** @var array<class-string> */
|
||||
public $value;
|
||||
|
||||
/** @param array<class-string> $value */
|
||||
public function __construct(array $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
24
src/Mapping/Attribute/DiscriminatorValue.php
Normal file
24
src/Mapping/Attribute/DiscriminatorValue.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Use the specified discriminator for this class
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class DiscriminatorValue implements MappingAttribute
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
52
src/Mapping/Attribute/Document.php
Normal file
52
src/Mapping/Attribute/Document.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Identifies a class as a document that can be stored in the database
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Document extends AbstractDocument
|
||||
{
|
||||
/** @var string|null */
|
||||
public $db;
|
||||
|
||||
/** @var string|null */
|
||||
public $repositoryClass;
|
||||
|
||||
/** @var Index[] */
|
||||
public $indexes;
|
||||
|
||||
/** @var bool */
|
||||
public $readOnly;
|
||||
|
||||
/** @var string|null */
|
||||
public $shardKey;
|
||||
|
||||
/**
|
||||
* @param string|array{name: string, capped?: bool, size?: int, max?: int}|null $collection
|
||||
* @param Index[] $indexes
|
||||
* @param int|string|null $writeConcern
|
||||
*/
|
||||
public function __construct(
|
||||
?string $db = null,
|
||||
public $collection = null,
|
||||
?string $repositoryClass = null,
|
||||
array $indexes = [],
|
||||
bool $readOnly = false,
|
||||
?string $shardKey = null,
|
||||
public $writeConcern = null,
|
||||
) {
|
||||
$this->db = $db;
|
||||
$this->repositoryClass = $repositoryClass;
|
||||
$this->indexes = $indexes;
|
||||
$this->readOnly = $readOnly;
|
||||
$this->shardKey = $shardKey;
|
||||
}
|
||||
}
|
||||
63
src/Mapping/Attribute/EmbedMany.php
Normal file
63
src/Mapping/Attribute/EmbedMany.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
use Doctrine\ODM\MongoDB\Utility\CollectionHelper;
|
||||
|
||||
/**
|
||||
* Embeds multiple documents
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class EmbedMany extends AbstractField implements MappingAttribute
|
||||
{
|
||||
/** @var bool */
|
||||
public $embedded = true;
|
||||
|
||||
/** @var string|null */
|
||||
public $targetDocument;
|
||||
|
||||
/** @var string|null */
|
||||
public $discriminatorField;
|
||||
|
||||
/** @var array<string, class-string>|null */
|
||||
public $discriminatorMap;
|
||||
|
||||
/** @var string|null */
|
||||
public $defaultDiscriminatorValue;
|
||||
|
||||
/** @var string|null */
|
||||
public $collectionClass;
|
||||
|
||||
/** @var bool */
|
||||
public $storeEmptyArray;
|
||||
|
||||
/** @param array<string, class-string>|null $discriminatorMap */
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
string $strategy = CollectionHelper::DEFAULT_STRATEGY,
|
||||
bool $notSaved = false,
|
||||
?string $targetDocument = null,
|
||||
?string $discriminatorField = null,
|
||||
?array $discriminatorMap = null,
|
||||
?string $defaultDiscriminatorValue = null,
|
||||
?string $collectionClass = null,
|
||||
bool $storeEmptyArray = false,
|
||||
) {
|
||||
parent::__construct($name, ClassMetadata::MANY, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->targetDocument = $targetDocument;
|
||||
$this->discriminatorField = $discriminatorField;
|
||||
$this->discriminatorMap = $discriminatorMap;
|
||||
$this->defaultDiscriminatorValue = $defaultDiscriminatorValue;
|
||||
$this->collectionClass = $collectionClass;
|
||||
$this->storeEmptyArray = $storeEmptyArray;
|
||||
}
|
||||
}
|
||||
52
src/Mapping/Attribute/EmbedOne.php
Normal file
52
src/Mapping/Attribute/EmbedOne.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
|
||||
/**
|
||||
* Embeds a single document
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class EmbedOne extends AbstractField implements MappingAttribute
|
||||
{
|
||||
/** @var bool */
|
||||
public $embedded = true;
|
||||
|
||||
/** @var string|null */
|
||||
public $targetDocument;
|
||||
|
||||
/** @var string|null */
|
||||
public $discriminatorField;
|
||||
|
||||
/** @var array<string, class-string>|null */
|
||||
public $discriminatorMap;
|
||||
|
||||
/** @var string|null */
|
||||
public $defaultDiscriminatorValue;
|
||||
|
||||
/** @param array<string, class-string>|null $discriminatorMap */
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = null,
|
||||
bool $notSaved = false,
|
||||
?string $targetDocument = null,
|
||||
?string $discriminatorField = null,
|
||||
?array $discriminatorMap = null,
|
||||
?string $defaultDiscriminatorValue = null,
|
||||
) {
|
||||
parent::__construct($name, ClassMetadata::ONE, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->targetDocument = $targetDocument;
|
||||
$this->discriminatorField = $discriminatorField;
|
||||
$this->discriminatorMap = $discriminatorMap;
|
||||
$this->defaultDiscriminatorValue = $defaultDiscriminatorValue;
|
||||
}
|
||||
}
|
||||
25
src/Mapping/Attribute/EmbeddedDocument.php
Normal file
25
src/Mapping/Attribute/EmbeddedDocument.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Identifies a class as a document that can be embedded but not stored by itself
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class EmbeddedDocument extends AbstractDocument
|
||||
{
|
||||
/** @var Index[] */
|
||||
public $indexes;
|
||||
|
||||
/** @param Index[] $indexes */
|
||||
public function __construct(array $indexes = [])
|
||||
{
|
||||
$this->indexes = $indexes;
|
||||
}
|
||||
}
|
||||
46
src/Mapping/Attribute/Encrypt.php
Normal file
46
src/Mapping/Attribute/Encrypt.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ODM\MongoDB\Mapping\EncryptQuery;
|
||||
use MongoDB\BSON\Decimal128;
|
||||
use MongoDB\BSON\Int64;
|
||||
use MongoDB\BSON\UTCDateTime;
|
||||
|
||||
/**
|
||||
* Defines an encrypted field mapping.
|
||||
*
|
||||
* @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/encrypt-and-query/#configure-encrypted-fields-for-optimal-search-and-storage
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY)]
|
||||
class Encrypt implements MappingAttribute
|
||||
{
|
||||
public int|float|Int64|Decimal128|UTCDateTime|null $min;
|
||||
public int|float|Int64|Decimal128|UTCDateTime|null $max;
|
||||
|
||||
/**
|
||||
* @param EncryptQuery|null $queryType Set the query type for the field, null if not queryable.
|
||||
* @param int<1, 4>|null $sparsity
|
||||
* @param positive-int|null $precision
|
||||
* @param positive-int|null $trimFactor
|
||||
* @param positive-int|null $contention
|
||||
*/
|
||||
public function __construct(
|
||||
public ?EncryptQuery $queryType = null,
|
||||
int|float|Int64|Decimal128|UTCDateTime|DateTimeInterface|null $min = null,
|
||||
int|float|Int64|Decimal128|UTCDateTime|DateTimeInterface|null $max = null,
|
||||
public ?int $sparsity = null,
|
||||
public ?int $precision = null,
|
||||
public ?int $trimFactor = null,
|
||||
public ?int $contention = null,
|
||||
) {
|
||||
$this->min = $min instanceof DateTimeInterface ? new UTCDateTime($min) : $min;
|
||||
$this->max = $max instanceof DateTimeInterface ? new UTCDateTime($max) : $max;
|
||||
}
|
||||
}
|
||||
38
src/Mapping/Attribute/Field.php
Normal file
38
src/Mapping/Attribute/Field.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
use BackedEnum;
|
||||
|
||||
/**
|
||||
* Specifies a generic field mapping
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Field extends AbstractField implements MappingAttribute
|
||||
{
|
||||
/** @var class-string<BackedEnum>|null */
|
||||
public $enumType;
|
||||
|
||||
/**
|
||||
* @param mixed[] $options
|
||||
* @param class-string<BackedEnum>|null $enumType
|
||||
*/
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
?string $type = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = null,
|
||||
bool $notSaved = false,
|
||||
?string $enumType = null,
|
||||
) {
|
||||
parent::__construct($name, $type, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->enumType = $enumType;
|
||||
}
|
||||
}
|
||||
60
src/Mapping/Attribute/File.php
Normal file
60
src/Mapping/Attribute/File.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Identifies a class as a GridFS file that can be stored in the database
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class File extends AbstractDocument
|
||||
{
|
||||
/** @var string|null */
|
||||
public $db;
|
||||
|
||||
/** @var string|null */
|
||||
public $bucketName;
|
||||
|
||||
/** @var string|null */
|
||||
public $repositoryClass;
|
||||
|
||||
/** @var Index[] */
|
||||
public $indexes;
|
||||
|
||||
/** @var bool bool */
|
||||
public $readOnly;
|
||||
|
||||
/** @var string|null */
|
||||
public $shardKey;
|
||||
|
||||
/** @var int|null */
|
||||
public $chunkSizeBytes;
|
||||
|
||||
/**
|
||||
* @param Index[] $indexes
|
||||
* @param string|int|null $writeConcern
|
||||
*/
|
||||
public function __construct(
|
||||
?string $db = null,
|
||||
?string $bucketName = null,
|
||||
?string $repositoryClass = null,
|
||||
array $indexes = [],
|
||||
bool $readOnly = false,
|
||||
?string $shardKey = null,
|
||||
public $writeConcern = null,
|
||||
?int $chunkSizeBytes = null,
|
||||
) {
|
||||
$this->db = $db;
|
||||
$this->bucketName = $bucketName;
|
||||
$this->repositoryClass = $repositoryClass;
|
||||
$this->indexes = $indexes;
|
||||
$this->readOnly = $readOnly;
|
||||
$this->shardKey = $shardKey;
|
||||
$this->chunkSizeBytes = $chunkSizeBytes;
|
||||
}
|
||||
}
|
||||
19
src/Mapping/Attribute/File/ChunkSize.php
Normal file
19
src/Mapping/Attribute/File/ChunkSize.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\MappingAttribute;
|
||||
|
||||
/** @final */
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class ChunkSize extends AbstractField implements MappingAttribute
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('chunkSize', 'int', false, [], null, true);
|
||||
}
|
||||
}
|
||||
19
src/Mapping/Attribute/File/Filename.php
Normal file
19
src/Mapping/Attribute/File/Filename.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\MappingAttribute;
|
||||
|
||||
/** @final */
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Filename extends AbstractField implements MappingAttribute
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('filename', 'string', false, [], null, true);
|
||||
}
|
||||
}
|
||||
19
src/Mapping/Attribute/File/Length.php
Normal file
19
src/Mapping/Attribute/File/Length.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\MappingAttribute;
|
||||
|
||||
/** @final */
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Length extends AbstractField implements MappingAttribute
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('length', 'int', false, [], null, true);
|
||||
}
|
||||
}
|
||||
49
src/Mapping/Attribute/File/Metadata.php
Normal file
49
src/Mapping/Attribute/File/Metadata.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\MappingAttribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
|
||||
|
||||
/** @final */
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Metadata extends AbstractField implements MappingAttribute
|
||||
{
|
||||
/** @var bool */
|
||||
public $embedded = true;
|
||||
|
||||
/** @var string|null */
|
||||
public $targetDocument;
|
||||
|
||||
/** @var string|null */
|
||||
public $discriminatorField;
|
||||
|
||||
/** @var array<string, class-string>|null */
|
||||
public $discriminatorMap;
|
||||
|
||||
/** @var string|null */
|
||||
public $defaultDiscriminatorValue;
|
||||
|
||||
/** @param array<string, class-string>|null $discriminatorMap */
|
||||
public function __construct(
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = null,
|
||||
bool $notSaved = false,
|
||||
?string $targetDocument = null,
|
||||
?string $discriminatorField = null,
|
||||
?array $discriminatorMap = null,
|
||||
?string $defaultDiscriminatorValue = null,
|
||||
) {
|
||||
parent::__construct('metadata', ClassMetadata::ONE, $nullable, $options, $strategy, $notSaved);
|
||||
|
||||
$this->targetDocument = $targetDocument;
|
||||
$this->discriminatorField = $discriminatorField;
|
||||
$this->discriminatorMap = $discriminatorMap;
|
||||
$this->defaultDiscriminatorValue = $defaultDiscriminatorValue;
|
||||
}
|
||||
}
|
||||
19
src/Mapping/Attribute/File/UploadDate.php
Normal file
19
src/Mapping/Attribute/File/UploadDate.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute\File;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\AbstractField;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Attribute\MappingAttribute;
|
||||
|
||||
/** @final */
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class UploadDate extends AbstractField implements MappingAttribute
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('uploadDate', 'date', false, [], null, true);
|
||||
}
|
||||
}
|
||||
18
src/Mapping/Attribute/HasLifecycleCallbacks.php
Normal file
18
src/Mapping/Attribute/HasLifecycleCallbacks.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Must be set on a document class to instruct Doctrine to check for lifecycle
|
||||
* callback annotations on public methods.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class HasLifecycleCallbacks implements MappingAttribute
|
||||
{
|
||||
}
|
||||
30
src/Mapping/Attribute/Id.php
Normal file
30
src/Mapping/Attribute/Id.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Special field mapping to map document identifiers
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Id extends AbstractField implements MappingAttribute
|
||||
{
|
||||
/** @var bool */
|
||||
public $id = true;
|
||||
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
?string $type = null,
|
||||
bool $nullable = false,
|
||||
array $options = [],
|
||||
?string $strategy = 'auto',
|
||||
bool $notSaved = false,
|
||||
) {
|
||||
parent::__construct($name, $type, $nullable, $options, $strategy, $notSaved);
|
||||
}
|
||||
}
|
||||
17
src/Mapping/Attribute/Index.php
Normal file
17
src/Mapping/Attribute/Index.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Defines an index on a field
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
|
||||
class Index extends AbstractIndex implements MappingAttribute
|
||||
{
|
||||
}
|
||||
24
src/Mapping/Attribute/InheritanceType.php
Normal file
24
src/Mapping/Attribute/InheritanceType.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Specifies which inheritance type to use for a document
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class InheritanceType implements MappingAttribute
|
||||
{
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
17
src/Mapping/Attribute/Lock.php
Normal file
17
src/Mapping/Attribute/Lock.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Specifies a field to use for pessimistic locking
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Lock implements MappingAttribute
|
||||
{
|
||||
}
|
||||
29
src/Mapping/Attribute/MappedSuperclass.php
Normal file
29
src/Mapping/Attribute/MappedSuperclass.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Specifies a parent class that other documents may extend to inherit mapping
|
||||
* information
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class MappedSuperclass extends AbstractDocument
|
||||
{
|
||||
/** @var string|null */
|
||||
public $repositoryClass;
|
||||
|
||||
/** @var string|null */
|
||||
public $collection;
|
||||
|
||||
public function __construct(?string $repositoryClass = null, ?string $collection = null)
|
||||
{
|
||||
$this->repositoryClass = $repositoryClass;
|
||||
$this->collection = $collection;
|
||||
}
|
||||
}
|
||||
14
src/Mapping/Attribute/MappingAttribute.php
Normal file
14
src/Mapping/Attribute/MappingAttribute.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
/**
|
||||
* A marker interface for mapping attributes.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
interface MappingAttribute
|
||||
{
|
||||
}
|
||||
17
src/Mapping/Attribute/PostLoad.php
Normal file
17
src/Mapping/Attribute/PostLoad.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a postLoad lifecycle callback
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PostLoad implements MappingAttribute
|
||||
{
|
||||
}
|
||||
17
src/Mapping/Attribute/PostPersist.php
Normal file
17
src/Mapping/Attribute/PostPersist.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a postPersist lifecycle callback
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PostPersist implements MappingAttribute
|
||||
{
|
||||
}
|
||||
17
src/Mapping/Attribute/PostRemove.php
Normal file
17
src/Mapping/Attribute/PostRemove.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a postRemove lifecycle callback
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PostRemove implements MappingAttribute
|
||||
{
|
||||
}
|
||||
17
src/Mapping/Attribute/PostUpdate.php
Normal file
17
src/Mapping/Attribute/PostUpdate.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a postUpdate lifecycle callback
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PostUpdate implements MappingAttribute
|
||||
{
|
||||
}
|
||||
17
src/Mapping/Attribute/PreFlush.php
Normal file
17
src/Mapping/Attribute/PreFlush.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a preFlush lifecycle callback
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PreFlush implements MappingAttribute
|
||||
{
|
||||
}
|
||||
17
src/Mapping/Attribute/PreLoad.php
Normal file
17
src/Mapping/Attribute/PreLoad.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a preLoad lifecycle callback
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PreLoad implements MappingAttribute
|
||||
{
|
||||
}
|
||||
17
src/Mapping/Attribute/PrePersist.php
Normal file
17
src/Mapping/Attribute/PrePersist.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ODM\MongoDB\Mapping\Attribute;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* Marks a method as a prePersist lifecycle callback
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PrePersist implements MappingAttribute
|
||||
{
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user