Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 3.3.x up into 3.4.x #11724

Merged
merged 29 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0a49274
Update aggregate-fields.rst
d-ph Mar 8, 2024
129553d
Allow overriding association's cascade
malarzm Jul 11, 2024
e7efded
Update README.md
beberlei Oct 18, 2024
039b032
Inherit issue templates
greg0ire Oct 20, 2024
85fc950
Merge pull request #11691 from greg0ire/inherit-issue-templates
greg0ire Oct 20, 2024
4d821cb
Remove config.yml
greg0ire Oct 20, 2024
af54a16
Merge pull request #11692 from greg0ire/inherit-issue-templates
greg0ire Oct 20, 2024
021a9cc
UPGRADE: mention `SqlWalker` deprecations in 3.3 (#11693)
janedbal Oct 22, 2024
05f5486
Merge pull request #11549 from doctrine/feature/allow-overriding-cascade
greg0ire Oct 22, 2024
439b4da
Is not correctly generated sql when changed/switched sqlFilter parame…
dbannik Oct 22, 2024
3ca9529
Merge pull request #11694 from dbannik/Bug-join-sql-when-change-sqlFi…
greg0ire Oct 23, 2024
44fa8bb
Merge pull request #11344 from d-ph/patch-2
greg0ire Oct 24, 2024
9e2bfa8
Run tests against PostgreSQL 17 (#11697)
IndraGunawan Oct 25, 2024
4b03ec7
Refine Explanations of Doctrine orm Package Structure (#11710)
Speelwolf Nov 11, 2024
ff3ccff
Add `isEmpty()` method to the Extra Lazy Associations tutorial
acasademont Nov 13, 2024
d9aa6ef
Merge pull request #11716 from acasademont/patch-1
greg0ire Nov 14, 2024
43ce0be
lazy and eager collection refresh
goetas Sep 26, 2022
7d1b24f
attempt a fix
goetas Sep 26, 2022
486e406
Merge pull request #10065 from goetas/lazy-eager-collection-refresh
greg0ire Nov 14, 2024
4fbce94
Bump codecov/codecov-action from 4 to 5
dependabot[bot] Nov 18, 2024
ba11851
Merge pull request #11718 from doctrine/dependabot/github_actions/2.2…
greg0ire Nov 18, 2024
bb5b2a3
Ignore deprecation about StaticReflectionService
greg0ire Nov 18, 2024
f140651
Merge pull request #11719 from greg0ire/ignore-deprecation
greg0ire Nov 18, 2024
346c498
Fix `Events::onFlush` and `PostFlush()` documentation: events are alw…
lyrixx Nov 7, 2024
58ad1d9
Merge pull request #11709 from lyrixx/fix-event-doc
greg0ire Nov 18, 2024
8422a41
unitofwork.rst: php => PHP
k00ni Jul 22, 2024
82e2c98
Merge pull request #11556 from k00ni/patch-1
greg0ire Nov 19, 2024
2ff998d
Merge remote-tracking branch 'origin/2.20.x' into 3.3.x
greg0ire Nov 23, 2024
71e038c
Merge pull request #11723 from greg0ire/3.3.x
greg0ire Nov 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions .github/ISSUE_TEMPLATE/BC_Break.md

This file was deleted.

34 changes: 0 additions & 34 deletions .github/ISSUE_TEMPLATE/Bug.md

This file was deleted.

18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE/Feature_Request.md

This file was deleted.

6 changes: 0 additions & 6 deletions .github/ISSUE_TEMPLATE/Support_Question.md

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
- "default"
- "3.7"
postgres-version:
- "15"
- "17"
extension:
- pdo_pgsql
- pgsql
Expand Down Expand Up @@ -341,7 +341,7 @@ jobs:
path: "reports"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v4"
uses: "codecov/codecov-action@v5"
with:
directory: reports
env:
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
| [![Build status][4.0 image]][4.0] | [![Build status][3.4 image]][3.4] | [![Build status][3.3 image]][3.3] | [![Build status][2.21 image]][2.21] | [![Build status][2.20 image]][2.20] |
| [![Coverage Status][4.0 coverage image]][4.0 coverage] | [![Coverage Status][3.4 coverage image]][3.4 coverage] | [![Coverage Status][3.3 coverage image]][3.3 coverage] | [![Coverage Status][2.21 coverage image]][2.21 coverage] | [![Coverage Status][2.20 coverage image]][2.20 coverage] |

[<h1 align="center">🇺🇦 UKRAINE NEEDS YOUR HELP NOW!</h1>](https://www.doctrine-project.org/stop-war.html)

Doctrine ORM is an object-relational mapper for PHP 8.1+ that provides transparent persistence
for PHP objects. It sits on top of a powerful database abstraction layer (DBAL). One of its key features
is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL),
Expand Down
10 changes: 10 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

The class `Doctrine\ORM\Mapping\Driver\DatabaseDriver` is deprecated without replacement.

## Add `Doctrine\ORM\Query\OutputWalker` interface, deprecate `Doctrine\ORM\Query\SqlWalker::getExecutor()`

Output walkers should implement the new `\Doctrine\ORM\Query\OutputWalker` interface and create
`Doctrine\ORM\Query\Exec\SqlFinalizer` instances instead of `Doctrine\ORM\Query\Exec\AbstractSqlExecutor`s.
The output walker must not base its workings on the query `firstResult`/`maxResult` values, so that the
`SqlFinalizer` can be kept in the query cache and used regardless of the actual `firstResult`/`maxResult` values.
Any operation dependent on `firstResult`/`maxResult` should take place within the `SqlFinalizer::createExecutor()`
method. Details can be found at https://github.com/doctrine/orm/pull/11188.


# Upgrade to 3.2

## Deprecate the `NotSupported` exception
Expand Down
2 changes: 1 addition & 1 deletion docs/en/cookbook/aggregate-fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ the database using a FOR UPDATE.
use Bank\Entities\Account;
use Doctrine\DBAL\LockMode;

$account = $em->find(Account::class, $accId, LockMode::PESSIMISTIC_READ);
$account = $em->find(Account::class, $accId, LockMode::PESSIMISTIC_WRITE);

Keeping Updates and Deletes in Sync
-----------------------------------
Expand Down
11 changes: 5 additions & 6 deletions docs/en/reference/architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ Doctrine ORM is divided into four main packages.
- ORM (depends on DBAL+Persistence+Collections)

This manual mainly covers the ORM package, sometimes touching parts
of the underlying DBAL and Persistence packages. The Doctrine code base
is split in to these packages for a few reasons and they are to...
of the underlying DBAL and Persistence packages. The Doctrine codebase
is split into these packages for a few reasons:


- ...make things more maintainable and decoupled
- ...allow you to use the code in Doctrine Persistence and Collections
without the ORM or DBAL
- ...allow you to use the DBAL without the ORM
- to make things more maintainable and decoupled
- to allow you to use the code in Doctrine Persistence and Collections without the ORM or DBAL
- to allow you to use the DBAL without the ORM

Collection, Event Manager and Persistence
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/en/reference/unitofwork.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ How Doctrine Detects Changes
----------------------------

Doctrine is a data-mapper that tries to achieve persistence-ignorance (PI).
This means you map php objects into a relational database that don't
This means you map PHP objects into a relational database that don't
necessarily know about the database at all. A natural question would now be,
"how does Doctrine even detect objects have changed?".

Expand Down
1 change: 1 addition & 0 deletions docs/en/tutorials/extra-lazy-associations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ can be called without triggering a full load of the collection:
- ``Collection#containsKey($key)``
- ``Collection#count()``
- ``Collection#get($key)``
- ``Collection#isEmpty()``
- ``Collection#slice($offset, $length = null)``

For each of the above methods the following semantics apply:
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<referencedClass name="Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand"/>
<referencedClass name="Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper"/>
<referencedClass name="Doctrine\ORM\Tools\Console\EntityManagerProvider\HelperSetManagerProvider"/>
<referencedClass name="Doctrine\Persistence\Mapping\StaticReflectionService"/>
</errorLevel>
</DeprecatedClass>
<DeprecatedMethod>
Expand Down
6 changes: 2 additions & 4 deletions src/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,14 @@ private function __construct()
* The onFlush event occurs when the EntityManager#flush() operation is invoked,
* after any changes to managed entities have been determined but before any
* actual database operations are executed. The event is only raised if there is
* actually something to do for the underlying UnitOfWork. If nothing needs to be done,
* the onFlush event is not raised.
* actually something to do for the underlying UnitOfWork.
*/
public const onFlush = 'onFlush';

/**
* The postFlush event occurs when the EntityManager#flush() operation is invoked and
* after all actual database operations are executed successfully. The event is only raised if there is
* actually something to do for the underlying UnitOfWork. If nothing needs to be done,
* the postFlush event is not raised. The event won't be raised if an error occurs during the
* actually something to do for the underlying UnitOfWork. The event won't be raised if an error occurs during the
* flush operation.
*/
public const postFlush = 'postFlush';
Expand Down
6 changes: 5 additions & 1 deletion src/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ public function setInheritanceType(int $type): void
/**
* Sets the association to override association mapping of property for an entity relationship.
*
* @psalm-param array<string, mixed> $overrideMapping
* @psalm-param array{joinColumns?: array, inversedBy?: ?string, joinTable?: array, fetch?: ?string, cascade?: string[]} $overrideMapping
*
* @throws MappingException
*/
Expand Down Expand Up @@ -1723,6 +1723,10 @@ public function setAssociationOverride(string $fieldName, array $overrideMapping
$mapping['fetch'] = $overrideMapping['fetch'];
}

if (isset($overrideMapping['cascade'])) {
$mapping['cascade'] = $overrideMapping['cascade'];
}

switch ($mapping['type']) {
case self::ONE_TO_ONE:
case self::MANY_TO_ONE:
Expand Down
5 changes: 4 additions & 1 deletion src/Persisters/Entity/BasicEntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ class BasicEntityPersister implements EntityPersister
private readonly CachedPersisterContext $limitsHandlingContext;
private readonly CachedPersisterContext $noLimitsContext;

private string|null $filterHash = null;

/**
* Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager
* and persists instances of the class described by the given ClassMetadata descriptor.
Expand Down Expand Up @@ -1229,7 +1231,7 @@ final protected function getOrderBySQL(array $orderBy, string $baseTableAlias):
*/
protected function getSelectColumnsSQL(): string
{
if ($this->currentPersisterContext->selectColumnListSql !== null) {
if ($this->currentPersisterContext->selectColumnListSql !== null && $this->filterHash === $this->em->getFilters()->getHash()) {
return $this->currentPersisterContext->selectColumnListSql;
}

Expand Down Expand Up @@ -1339,6 +1341,7 @@ protected function getSelectColumnsSQL(): string
}

$this->currentPersisterContext->selectColumnListSql = implode(', ', $columnList);
$this->filterHash = $this->em->getFilters()->getHash();

return $this->currentPersisterContext->selectColumnListSql;
}
Expand Down
4 changes: 2 additions & 2 deletions src/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -2003,13 +2003,13 @@ private function doRefresh(object $entity, array &$visited, LockMode|int|null $l
throw ORMInvalidArgumentException::entityNotManaged($entity);
}

$this->cascadeRefresh($entity, $visited, $lockMode);

$this->getEntityPersister($class->name)->refresh(
array_combine($class->getIdentifierFieldNames(), $this->entityIdentifiers[$oid]),
$entity,
$lockMode,
);

$this->cascadeRefresh($entity, $visited, $lockMode);
}

/**
Expand Down
Loading
Loading