persistence Documentation

The Doctrine Persistence project is a library that provides common abstractions for object mapper persistence.

4,043 stars PHP PHP 1 file ยท ~7,947 tokens #hacktoberfest#persistence
RAW Doc

File: README.md

Doctrine Persistence

GitHub Actions
Code Coverage

The Doctrine Persistence project is a library that provides common abstractions for object mapper persistence.

More resources:


File: composer.json

{
"name": "doctrine/persistence",
"type": "library",
"description": "The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.",
"keywords": [
"persistence",
"object",
"mapper",
"orm",
"odm"
],
"homepage": "https://www.doctrine-project.org/projects/persistence.html",
"license": "MIT",
"authors": [
{"name": "Guilherme Blanco", "email": "[email protected]"},
{"name": "Roman Borschel", "email": "[email protected]"},
{"name": "Benjamin Eberlei", "email": "[email protected]"},
{"name": "Jonathan Wage", "email": "[email protected]"},
{"name": "Johannes Schmitt", "email": "[email protected]"},
{"name": "Marco Pivetta", "email": "[email protected]"}
],
"require": {
"php": "^8.1",
"doctrine/deprecations": "^1",
"doctrine/event-manager": "^1 || ^2",
"psr/cache": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"phpstan/phpstan": "2.1.30",
"phpstan/phpstan-phpunit": "^2",
"phpstan/phpstan-strict-rules": "^2",
"doctrine/coding-standard": "^14",
"phpunit/phpunit": "^10.5.58 || ^12",
"symfony/cache": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/finder": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0"
},
"autoload": {
"psr-4": {
"Doctrine\Persistence\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Doctrine\Tests\Persistence\": "tests"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/package-versions-deprecated": true
}
},
"scripts": {
"docs": "composer --working-dir docs update && ./docs/vendor/bin/build-docs.sh @additional_args"
}
}


File: SECURITY.md

Security

If you find a Security bug in Doctrine, please follow our
Security reporting guidelines.

Security vulnerabilities should be reported to [email protected]
and not posted on the GitHub issue tracker of the project.


File: UPGRADE.md

Note about upgrading: Doctrine uses static and runtime mechanisms to raise
awareness about deprecated code.

  • Use of @deprecated docblock that is detected by IDEs (like PHPStorm) or
    Static Analysis tools (like Psalm, phpstan)
  • Use of our low-overhead runtime deprecation API, details:
    https://github.com/doctrine/deprecations/

Upgrade to 4.2

Add `getFieldValue` and `setFieldValue` to `ClassMetadata` implementation

The interface Doctrine\Persistence\Mapping\ClassMetadata has two new methods:

  • getFieldValue(object $object, string $field)
  • setFieldValue(object $object, string $field, mixed $value): void

Not implementing these methods is deprecated. They will be required in 5.0.

Several classes are marked as `@final`

The following classes are now marked with @final and should not be extended:

  • Doctrine\Persistence\Mapping\Driver\DefaultFileLocator
  • Doctrine\Persistence\Mapping\Driver\MappingDriverChain
  • Doctrine\Persistence\Mapping\Driver\PHPDriver
  • Doctrine\Persistence\Mapping\Driver\StaticPHPDriver
  • Doctrine\Persistence\Mapping\Driver\SymfonyFileLocator
  • Doctrine\Persistence\Mapping\RuntimeReflectionService
  • Doctrine\Persistence\Reflection\EnumReflectionProperty
  • Doctrine\Persistence\Reflection\TypedNoDefaultReflectionProperty

These classes were not designed for extension and will be marked with the final
keyword in 5.0.

Additionally, Doctrine\Persistence\Reflection\RuntimeReflectionProperty is marked
with @phpstan-sealed to restrict extension to only TypedNoDefaultReflectionProperty.
Extending this class in your code is not supported.

Deprecated modifying `$metadata` in PHP mapping files

Relying on the $metadata variable directly in PHP mapping files is deprecated.
Instead, wrap the code in a closure that is returned by the configuration file.

Before:

php
<?php // mappings/App.Entity.User.php

$metadata->name = \App\Entity\User::class;

After:

php
<?php // mappings/App.Entity.User.php

use Doctrine\Persistence\Mapping\ClassMetadata;

return function (ClassMetadata $metadata): void {
    $metadata->name = \App\Entity\User::class;
};

`StaticPHPDriver` now accepts a `ClassLocator`

The constructor of StaticPHPDriver now accepts a ClassLocator instance
in addition to a path or array of paths:

php
$driver = new StaticPHPDriver(new ClassNames([MyEntity::class, AnotherEntity::class]));

Using a ClassLocator implementation is recommended instead of relying
on directory scanning.

Do not pass any proxy interface to `AbstractManagerRegistry` when using native proxies

With PHP 8.4 native lazy objects, you don't need to pass any proxy interface to
AbstractManagerRegistry. The class of the lazy objects is the class being mapped.

Upgrade to 4.0

BC Break: Removed `StaticReflectionService`

The class Doctrine\Persistence\Mapping\StaticReflectionService is removed
without replacement.

BC Break: Narrowed `ReflectionService::getClass()` return type

The return type of ReflectionService::getClass() has been narrowed so that
null is no longer a valid return value.

BC Break: Added `ObjectManager::isUninitializedObject()`

Classes implementing Doctrine\Persistence\ObjectManager must implement this
new method.

BC Break: Added type declarations

The code base is now fully typed, meaning properties, parameters and return
type declarations have been added to all types.

BC Break: Dropped support for Common proxies

Proxy objects implementing the Doctrine\Common\Proxy\Proxy interface are not
supported anymore. Implement Doctrine\Persistence\Proxy instead.

BC Break: Removed deprecated ReflectionProperty overrides

Deprecated classes have been removed:

  • Doctrine\Persistence\Reflection\RuntimePublicReflectionProperty
  • Doctrine\Persistence\Reflection\TypedNoDefaultRuntimePublicReflectionProperty

Upgrade to 3.4

Deprecated `StaticReflectionService`

The class Doctrine\Persistence\Mapping\StaticReflectionService is deprecated
without replacement.

Upgrade to 3.3

Added method `ObjectManager::isUninitializedObject()`

Classes implementing Doctrine\Persistence\ObjectManager should implement the new
method. This method will be added to the interface in 4.0.

Upgrade to 3.1

Deprecated `RuntimePublicReflectionProperty`

Use RuntimeReflectionProperty instead.

Upgrade to 3.0

Removed `OnClearEventArgs::clearsAllEntities()` and `OnClearEventArgs::getEntityClass()`

These methods only make sense when partially clearing the object manager, which
is no longer possible.
The second argument of the constructor of OnClearEventArgs is removed as well.

BC Break: removed `ObjectManagerAware`

Implement active record style functionality directly in your application, by
using a postLoad event.

BC Break: removed `AnnotationDriver`

Use ColocatedMappingDriver instead.

BC Break: Removed `MappingException::pathRequired()`

Use MappingException::pathRequiredForDriver() instead.

BC Break: removed `LifecycleEventArgs::getEntity()`

Use LifecycleEventArgs::getObject() instead.

BC Break: removed support for short namespace aliases

  • AbstractClassMetadataFactory::getFqcnFromAlias() is removed.
  • ClassMetadataFactory methods now require their $className argument to be an
    actual FQCN.

BC Break: removed `ObjectManager::merge()`

ObjectManagerDecorator::merge() is removed without replacement.

BC Break: removed support for `doctrine/cache`

Removed support for using doctrine/cache for metadata caching. The
setCacheDriver and getCacheDriver methods have been removed from
Doctrine\Persistence\Mapping\AbstractMetadata. Please use getCache and
setCache with a PSR-6 implementation instead.

BC Break: changed signatures

$objectName has been dropped from the signature of ObjectManager::clear().

diff
- public function clear($objectName = null)
+ public function clear(): void

Also, native parameter type declarations have been added on all public APIs.
Native return type declarations have not been added so that it is possible to
implement types compatible with both 2.x and 3.x.

BC Break: Removed `PersistentObject`

Please implement this functionality directly in your application if you want
ActiveRecord style functionality.

Upgrade to 2.5

Deprecated `OnClearEventArgs::clearsAllEntities()` and `OnClearEventArgs::getEntityClass()`

These methods only make sense when partially clearing the object manager, which
is deprecated.
Passing a second argument to the constructor of OnClearEventArgs is
deprecated as well.

Deprecated `ObjectManagerAware`

Along with deprecating PersistentObject, deprecating ObjectManagerAware
means deprecating support for active record, which already came with a word of
warning. Please implement this directly in your application with a postLoad
event if you need active record style functionality.

Deprecated `MappingException::pathRequired()`

MappingException::pathRequiredForDriver() should be used instead.

Upgrade to 2.4

Deprecated `AnnotationDriver`

Since attributes were introduced in PHP 8.0, annotations are deprecated.
AnnotationDriver is an abstract class that is used when implementing concrete
annotation drivers in dependent packages. It is deprecated in favor of using
ColocatedMappingDriver to implement both annotation and attribute based
drivers. This will involve implementing isTransient() as well as
__construct() and getReader() to retain backward compatibility.

Upgrade to 2.3

Deprecated using short namespace alias syntax in favor of `::class` syntax.

Before:

php
$objectManager->find('MyPackage:MyClass', $id);
$objectManager->createQuery('SELECT u FROM MyPackage:MyClass');

After:

php
$objectManager->find(MyClass::class, $id);
$objectManager->createQuery('SELECT u FROM '. MyClass::class);

Upgrade to 2.2

Deprecated `doctrine/cache` usage for metadata caching

The setCacheDriver and getCacheDriver methods in
Doctrine\Persistence\Mapping\AbstractMetadata have been deprecated. Please
use getCache and setCache with a PSR-6 implementation instead. Note that
even after switching to PSR-6, getCacheDriver will return a cache instance
that wraps the PSR-6 cache. Note that if you use a custom implementation of
doctrine/cache, the library may not be able to provide a forward compatibility
layer. The cache implementation MUST extend the
Doctrine\Common\Cache\CacheProvider class.

Upgrade to 1.2

Deprecated `ObjectManager::merge()` and `ObjectManager::detach()`

Please handle merge operations in your application, and use
ObjectManager::clear() instead.

Deprecated `PersistentObject`

Please implement this functionality directly in your application if you want
ActiveRecord style functionality.


File: .doctrine-project.json

{
"active": true,
"name": "Persistence",
"slug": "persistence",
"docsSlug": "doctrine-persistence",
"versions": [
{
"name": "5.0",
"branchName": "5.0.x",
"slug": "latest",
"upcoming": true
},
{
"name": "4.3",
"branchName": "4.3.x",
"slug": "4.3",
"upcoming": true
},
{
"name": "4.2",
"branchName": "4.2.x",
"slug": "4.2",
"current": true
},
{
"name": "4.1",
"slug": "4.1",
"maintained": false
},
{
"name": "4.0",
"slug": "4.0",
"maintained": false
},
{
"name": "3.4",
"branchName": "3.4.x",
"slug": "3.4",
"maintained": true
},
{
"name": "3.3",
"slug": "3.3",
"maintained": false
},
{
"name": "3.2",
"slug": "3.2",
"maintained": false
},
{
"name": "3.1",
"slug": "3.1",
"maintained": false
},
{
"name": "2.5",
"slug": "2.5",
"maintained": false
},
{
"name": "1.3",
"slug": "1.3",
"maintained": false
}
]
}


File: docs/composer.json

{
"require": {
"doctrine/docs-builder": "^1.0"
}
}


File: docs/en/index.rst

Persistence Documentation

The Doctrine Persistence documentation is a reference guide to everything you need
to know about the project.

Getting Help

If this documentation is not helping to answer questions you have about the
Doctrine Persistence project, don't panic. You can get help from different sources:

  • Slack chat room #persistence <https://www.doctrine-project.org/slack>_
  • On Stack Overflow <http://stackoverflow.com/questions/tagged/doctrine-persistence>_
  • The Doctrine Mailing List <http://groups.google.com/group/doctrine-user>_
  • Report a bug on GitHub <https://github.com/doctrine/persistence/issues>_.

Getting Started

The best way to get started is with the :doc:Introduction <reference/index#introduction> section
in the documentation. Use the sidebar to browse other documentation for the Doctrine Persistence project.


File: docs/en/sidebar.rst

:orphan:

.. toctree::
:depth: 3

text
reference/index
reference/object-change-tracking

File: docs/en/reference/index.rst

Introduction

The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine
object mappers share. You can use these interfaces and abstract classes to build your own mapper if you don't
want to use the full data mappers provided by Doctrine.

Installation

The library can easily be installed with composer.

.. code-block:: sh

text
$ composer require doctrine/persistence

Overview

The interfaces and functionality in this project evolved from building several different implementations of Doctrine
object mappers. The first implementation was the ORM_ then came the MongoDB ODM. A set of common interfaces were
extracted from both projects and released in the Doctrine Common
project. Over the years, more common functionality
was extracted and eventually moved to this standalone project.
After that, that project was itself split into several projects
including this one.

A Doctrine object mapper looks like this when implemented.

.. code-block:: php

text
final class User
{
    /** @var string */
    private $username;

    public function __construct(string $username)
    {
        $this->username = $username;
    }

    // ...
}

$objectManager = new ObjectManager();
$userRepository = $objectManager->getRepository(User::class);

$newUser = new User('jwage');

$objectManager->persist($newUser);
$objectManager->flush();

$user = $objectManager->find(User::class, 1);

$objectManager->remove($user);
$objectManager->flush();

$users = $userRepository->findAll();

To learn more about the full interfaces and functionality continue reading!

Object Manager

The main public interface that an end user will use is the Doctrine\Persistence\ObjectManager interface.

.. code-block:: php

text
namespace Doctrine\Persistence;

interface ObjectManager
{
    public function find($className, $id);
    public function persist($object);
    public function remove($object);
    public function clear();
    public function detach($object);
    public function refresh($object);
    public function flush();
    public function getRepository($className);
    public function getClassMetadata($className);
    public function getMetadataFactory();
    public function initializeObject($obj);
    public function contains($object);
}

ObjectRepository

The object repository is used to retrieve instances of your mapped objects from the mapper.

.. code-block:: php

text
namespace Doctrine\Persistence;

interface ObjectRepository
{
    public function find($id);
    public function findAll();
    public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null);
    public function findOneBy(array $criteria);
    public function getClassName();
}

Mapping

In order for Doctrine to be able to persist your objects to a data store, you have to map the classes and class
properties so they can be properly stored and retrieved while maintaining a consistent state.

ClassMetadata

.. code-block:: php

text
namespace Doctrine\Persistence\Mapping;

interface ClassMetadata
{
    public function getName();
    public function getIdentifier();
    public function getReflectionClass();
    public function isIdentifier($fieldName);
    public function hasField($fieldName);
    public function hasAssociation($fieldName);
    public function isSingleValuedAssociation($fieldName);
    public function isCollectionValuedAssociation($fieldName);
    public function getFieldNames();
    public function getIdentifierFieldNames();
    public function getAssociationNames();
    public function getTypeOfField($fieldName);
    public function getAssociationTargetClass($assocName);
    public function isAssociationInverseSide($assocName);
    public function getAssociationMappedByTargetField($assocName);
    public function getIdentifierValues($object);
}

ClassMetadataFactory

The Doctrine\Persistence\Mapping\ClassMetadataFactory class can be used to manage the instances for each of
your mapped PHP classes.

.. code-block:: php

text
namespace Doctrine\Persistence\Mapping;

interface ClassMetadataFactory
{
    public function getAllMetadata();
    public function getMetadataFor($className);
    public function hasMetadataFor($className);
    public function setMetadataFor($className, $class); // Deprecated
    public function isTransient($className);
}

The method setMetadataFor() is deprecated and should not be used.

Mapping Driver

In order to load ClassMetadata instances you can use the Doctrine\Persistence\Mapping\Driver\MappingDriver
interface. This is the interface that does the core loading of mapping information from wherever they are stored.
That may be in files, attributes, yaml, xml, etc.

.. code-block:: php

text
namespace Doctrine\Persistence\Mapping\Driver;

use Doctrine\Persistence\Mapping\ClassMetadata;

interface MappingDriver
{
    public function loadMetadataForClass($className, ClassMetadata $metadata);
    public function getAllClassNames();
    public function isTransient($className);
}

The Doctrine Persistence project offers a few base implementations that
make it easy to implement your own XML, Attributes or YAML drivers.

In the following examples, $classMetadata is an instance of your mapper's
implementation of ClassMetadata for User. ClassMetadata itself is
an interface and cannot be instantiated.

FileDriver

The file driver operates in a mode where it loads the mapping files of individual classes on demand. This requires
the user to adhere to the convention of 1 mapping file per class and the file names of the mapping files must
correspond to the full class name, including namespace, with the namespace delimiters '', replaced by dots '.'.

Extend the Doctrine\Persistence\Mapping\Driver\FileDriver class to implement your own file driver.
Here is an example JSON file driver implementation.

.. code-block:: php

text
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\FileDriver;

final class JSONFileDriver extends FileDriver
{
    public function loadMetadataForClass(string $className, ClassMetadata $metadata): void
    {
        $mappingFileData = $this->getElement($className);

        // use the array of mapping information from the file to populate the $metadata instance
    }

    protected function loadMappingFile(string $file): array
    {
        return json_decode(file_get_contents($file), true);
    }
}

Now you can use it like the following.

.. code-block:: php

text
use Doctrine\Persistence\Mapping\Driver\DefaultFileLocator;

$fileLocator = new DefaultFileLocator('/path/to/mapping/files', '.json');

$jsonFileDriver = new JSONFileDriver($fileLocator);

Now if you have a class named App\Model\User and you can load the mapping information like this.

.. code-block:: php

text
use App\Model\User;
use Doctrine\Persistence\Mapping\ClassMetadata;

// looks for a file at /path/to/mapping/files/App.Model.User.json
$jsonFileDriver->loadMetadataForClass(User::class, $classMetadata);

PHPDriver

The PHPDriver includes PHP files which just populate ClassMetadata instances with plain PHP code.

.. code-block:: php

text
use Doctrine\Persistence\Mapping\Driver\PHPDriver;

$phpDriver = new PHPDriver('/path/to/mapping/files');

Now you can use it like the following:

.. code-block:: php

text
use App\Model\User;
use Doctrine\Persistence\Mapping\ClassMetadata;

// looks for a PHP file at /path/to/mapping/files/App.Model.User.php
$phpDriver->loadMetadataForClass(User::class, $classMetadata);

Inside the /path/to/mapping/files/App.Model.User.php file you can write raw PHP code to populate a ClassMetadata
instance. You will have access to a variable named $metadata inside the file that you can use to populate the
mapping metadata.

.. code-block:: php

text
use App\Model\User;
use Doctrine\Persistence\Mapping\ClassMetadata;

return function (ClassMetadata $metadata): void {
    $metadata->name = User::class;

    // ...

};

StaticPHPDriver

The StaticPHPDriver calls a static loadMetadata() method on your model classes where you can manually populate the
ClassMetadata instance.

.. code-block:: php

text
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;

$staticPHPDriver = new StaticPHPDriver('/path/to/classes');

// calls User::loadMetadata() to populate $classMetadata
$staticPHPDriver->loadMetadataForClass(User::class, $classMetadata);

Your class in App\Model\User would look like the following.

.. code-block:: php

text
namespace App\Model;

use Doctrine\Persistence\Mapping\ClassMetadata;

final class User
{
    // ...

    public static function loadMetadata(ClassMetadata $metadata)
    {
        // populate the $metadata instance
    }
}

Reflection

Doctrine uses reflection to set and get the data inside your objects. The
Doctrine\Persistence\Mapping\ReflectionService is the primary interface needed for a Doctrine mapper.

.. code-block:: php

text
namespace Doctrine\Persistence\Mapping;

interface ReflectionService
{
    public function getParentClasses($class);
    public function getClassShortName($class);
    public function getClassNamespace($class);
    public function getClass($class);
    public function getAccessibleProperty($class, $property);
    public function hasPublicMethod($class, $method);
}

Doctrine provides an implementation of this interface in the class named
Doctrine\Persistence\Mapping\RuntimeReflectionService.

Implementations

There are several different implementations of the Doctrine Persistence APIs.

  • ORM_ - The Doctrine Object Relational Mapper is a data mapper for relational databases.
  • MongoDB ODM_ - The Doctrine MongoDB ODM is a data mapper for MongoDB.
  • PHPCR ODM_ - The Doctrine PHPCR ODM a data mapper built on top of the PHPCR API.

.. _ORM: https://www.doctrine-project.org/projects/orm.html
.. _MongoDB ODM: https://www.doctrine-project.org/projects/mongodb-odm.html
.. _PHPCR ODM: https://www.doctrine-project.org/projects/phpcr-odm.html
.. _Doctrine Common: https://www.doctrine-project.org/projects/common.html


File: docs/en/reference/object-change-tracking.rst

.. object_change_tracking:

Object Change Tracking

Change tracking is the process of determining what has changed in
observed objects since the last time they were synchronized with
the persistence backend.

This approach is based on the observer pattern <https://en.wikipedia.org/wiki/Observer_pattern>_
and consists of the following two interfaces:

  • Doctrine\Persistence\NotifyPropertyChanged that is implemented by the object
    whose changes can be tracked,
  • Doctrine\Persistence\PropertyChangedListener that is implemented by subscribers
    which are interested in tracking the changes.

Notifying subscribers

text
A class that wants to allow other objects to subscribe needs to
implement the ``NotifyPropertyChanged`` interface. As a guideline,
such an implementation can look as follows:

.. code-block:: php

    <?php

    use Doctrine\Persistence\NotifyPropertyChanged;
    use Doctrine\Persistence\PropertyChangedListener;

    class MyTrackedObject implements NotifyPropertyChanged
    {
        // ...

        /** @var PropertyChangedListener[] */
        private $listeners = [];

        public function addPropertyChangedListener(PropertyChangedListener $listener) : void
        {
            $this->listeners[] = $listener;
        }
    }

Then, in each mutator of this class or any derived classes, you
need to notify all the ``PropertyChangedListener`` instances. As an
example we add a convenience method on ``MyTrackedObject`` that shows
this behavior:

.. code-block:: php

    <?php

    // ...

    class MyTrackedObject implements NotifyPropertyChanged
    {
        // ...

        final protected function notifySubscribers(string $propertyName, $oldValue, $newValue) : void
        {
            foreach ($this->listeners as $listener) {
                $listener->propertyChanged($this, $propertyName, $oldValue, $newValue);
            }
        }

        public function setAge(int $age) : void
        {
            if ($this->age === $age) {
                return;
            }

            $this->notifySubscribers('age', $this->age, $age);
            $this->age = $age;
        }
    }

You have to invoke ``notifySubscribers()`` inside every method that
changes the persistent state of ``MyTrackedObject``.

The check whether the new value is different from the old one is
not mandatory but recommended. That way you also have full control
over when you consider a property changed.

---

## File: tests/Mapping/_custom_ns/dir/stdClass.yml

test

---

## File: tests/Mapping/_custom_ns/dir/sub/subClass.yml

test

---

## File: tests/Mapping/_custom_ns/dir/sub/subsub/subSubClass.yml

test

---

## File: tests/Mapping/_custom_ns/dot/stdClass.yml

test

---

## File: tests/Mapping/_custom_ns/dot/sub.subClass.yml

test

---

## File: tests/Mapping/_custom_ns/dot/sub.subsub.subSubClass.yml

test

---

## File: tests/Mapping/_files/global.yml

test

---

## File: tests/Mapping/_files/stdClass.yml

test

---

## File: tests/Mapping/_files/Bar/subDirClass.yml

test

---

## File: tests/Mapping/_match_ns/testEntity.yml

test

---

## File: tests/Mapping/_match_ns/Bar/barEntity.yml

test

---

## File: .github/dependabot.yml

version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"
    labels:
      - "CI"
    target-branch: "3.4.x"
    groups:
      doctrine:
        patterns:
          - "doctrine/*"

---

## File: .github/FUNDING.yml

patreon: phpdoctrine
tidelift: packagist/doctrine%2Fpersistence
custom: https://www.doctrine-project.org/sponsorship.html

---

## File: .github/workflows/coding-standards.yml

name: "Coding Standards"

on:
  pull_request:
    branches:
      - "*.x"
  push:
    branches:
      - "*.x"

jobs:
  coding-standards:
    name: "Coding Standards"
    uses: "doctrine/.github/.github/workflows/[email protected]"

---

## File: .github/workflows/continuous-integration.yml

name: "Continuous Integration"

on:
  pull_request:
    branches:
      - "*.x"
  push:
    branches:
      - "*.x"

jobs:
  phpunit:
    name: "PHPUnit"
    uses: "doctrine/.github/.github/workflows/[email protected]"
    with:
      php-versions: '["8.1", "8.2", "8.3", "8.4", "8.5"]'
      phpunit-options-lowest: "--do-not-fail-on-deprecation"
    secrets:
      CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"

---

## File: .github/workflows/documentation.yml

name: "Documentation"

on:
  pull_request:
    branches:
      - "*.x"
    paths:
      - .github/workflows/documentation.yml
      - docs/**
  push:
    branches:
      - "*.x"
    paths:
      - .github/workflows/documentation.yml
      - docs/**

jobs:
  documentation:
    name: "Documentation"
    uses: "doctrine/.github/.github/workflows/[email protected]"

---

## File: .github/workflows/release-on-milestone-closed.yml

name: "Automatic Releases"

on:
  milestone:
    types:
      - "closed"

jobs:
  release:
    name: "Git tag, release & create merge-up PR"
    uses: "doctrine/.github/.github/workflows/[email protected]"
    secrets:
      GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
      GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
      ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
      SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}

---

## File: .github/workflows/static-analysis.yml

name: "Static Analysis"

on:
  pull_request:
    branches:
      - "*.x"
  push:
    branches:
      - "*.x"

jobs:
  static-analysis:
    name: "Static Analysis"
    uses: "doctrine/.github/.github/workflows/[email protected]"

---

## File: .github/workflows/website-schema.yml

name: "Website config validation"

on:
  pull_request:
    branches:
      - "*.x"
    paths:
      - ".doctrine-project.json"
      - ".github/workflows/website-schema.yml"
  push:
    branches:
      - "*.x"
    paths:
      - ".doctrine-project.json"
      - ".github/workflows/website-schema.yml"

jobs:
  json-validate:
    name: "Validate JSON schema"
    uses: "doctrine/.github/.github/workflows/[email protected]"