Skip to content

Commit e89b58a

Browse files
authored
Merge pull request #11771 from doctrine/2.20.x-merge-up-into-2.21.x_3Yg2ZYgM
Merge release 2.20.1 into 2.21.x
2 parents 2b94ec1 + e3cabad commit e89b58a

File tree

7 files changed

+36
-19
lines changed

7 files changed

+36
-19
lines changed

.github/workflows/coding-standards.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ on:
2424

2525
jobs:
2626
coding-standards:
27-
uses: "doctrine/.github/.github/workflows/coding-standards.yml@6.0.0"
27+
uses: "doctrine/.github/.github/workflows/coding-standards.yml@7.1.0"

.github/workflows/documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ on:
1717
jobs:
1818
documentation:
1919
name: "Documentation"
20-
uses: "doctrine/.github/.github/workflows/documentation.yml@6.0.0"
20+
uses: "doctrine/.github/.github/workflows/documentation.yml@7.1.0"

.github/workflows/release-on-milestone-closed.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
release:
10-
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@6.0.0"
10+
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@7.1.0"
1111
secrets:
1212
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
1313
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}

docs/en/reference/basic-mapping.rst

+1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ Here is a complete list of ``Column``s attributes (all optional):
239239
- ``nullable`` (default: ``false``): Whether the column is nullable.
240240
- ``insertable`` (default: ``true``): Whether the column should be inserted.
241241
- ``updatable`` (default: ``true``): Whether the column should be updated.
242+
- ``generated`` (default: ``null``): Whether the generated strategy should be ``'NEVER'``, ``'INSERT'`` and ``ALWAYS``.
242243
- ``enumType`` (requires PHP 8.1 and ``doctrine/orm`` 2.11): The PHP enum class name to convert the database value into.
243244
- ``precision`` (default: 0): The precision for a decimal (exact numeric) column
244245
(applies only for decimal column),

docs/en/tutorials/override-field-association-mappings-in-subclasses.rst

+13-15
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,28 @@ i.e. attributes and associations metadata in particular. The example here shows
99
the overriding of a class that uses a trait but is similar when extending a base
1010
class as shown at the end of this tutorial.
1111

12-
Suppose we have a class ExampleEntityWithOverride. This class uses trait ExampleTrait:
12+
Suppose we have a class ``ExampleEntityWithOverride``. This class uses trait ``ExampleTrait``:
1313

1414
.. code-block:: php
1515
1616
<?php
1717
1818
#[Entity]
1919
#[AttributeOverrides([
20-
new AttributeOverride('foo', [
21-
'column' => new Column([
22-
'name' => 'foo_overridden',
23-
'type' => 'integer',
24-
'length' => 140,
25-
'nullable' => false,
26-
'unique' => false,
27-
]),
28-
]),
20+
new AttributeOverride('foo', new Column(
21+
name: 'foo_overridden',
22+
type: 'integer',
23+
length: 140,
24+
nullable: false,
25+
unique: false,
26+
)),
2927
])]
3028
#[AssociationOverrides([
3129
new AssociationOverride('bar', [
32-
'joinColumns' => new JoinColumn([
33-
'name' => 'example_entity_overridden_bar_id',
34-
'referencedColumnName' => 'id',
35-
]),
30+
new JoinColumn(
31+
name: 'example_entity_overridden_bar_id',
32+
referencedColumnName: 'id',
33+
),
3634
]),
3735
])]
3836
class ExampleEntityWithOverride
@@ -47,7 +45,7 @@ Suppose we have a class ExampleEntityWithOverride. This class uses trait Example
4745
private $id;
4846
}
4947
50-
The docblock is showing metadata override of the attribute and association type. It
48+
``#[AttributeOverrides]`` contains metadata override of the attribute and association type. It
5149
basically changes the names of the columns mapped for a property ``foo`` and for
5250
the association ``bar`` which relates to Bar class shown above. Here is the trait
5351
which has mapping metadata that is overridden by the attribute above:

src/UnitOfWork.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2968,7 +2968,7 @@ public function createEntity($className, array $data, &$hints = [])
29682968
$oid = spl_object_id($entity);
29692969
$this->registerManaged($entity, $id, $data);
29702970

2971-
if (isset($hints[Query::HINT_READ_ONLY])) {
2971+
if (isset($hints[Query::HINT_READ_ONLY]) && $hints[Query::HINT_READ_ONLY] === true) {
29722972
$this->readOnlyObjects[$oid] = true;
29732973
}
29742974
}

tests/Tests/ORM/Functional/ReadOnlyTest.php

+18
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,24 @@ public function testReadOnlyQueryHint(): void
9090
self::assertTrue($this->_em->getUnitOfWork()->isReadOnly($user));
9191
}
9292

93+
public function testNotReadOnlyQueryHint(): void
94+
{
95+
$user = new ReadOnlyEntity('beberlei', 1234);
96+
97+
$this->_em->persist($user);
98+
99+
$this->_em->flush();
100+
$this->_em->clear();
101+
102+
$query = $this->_em->createQuery('SELECT u FROM ' . ReadOnlyEntity::class . ' u WHERE u.id = ?1');
103+
$query->setParameter(1, $user->id);
104+
$query->setHint(Query::HINT_READ_ONLY, false);
105+
106+
$user = $query->getSingleResult();
107+
108+
self::assertFalse($this->_em->getUnitOfWork()->isReadOnly($user));
109+
}
110+
93111
public function testNotReadOnlyIfObjectWasProxyBefore(): void
94112
{
95113
$user = new ReadOnlyEntity('beberlei', 1234);

0 commit comments

Comments
 (0)