Skip to content

Commit

Permalink
Merge pull request #10400 from doctrine/2.14.x
Browse files Browse the repository at this point in the history
Merge 2.14.x up into 2.15.x
  • Loading branch information
greg0ire authored Jan 14, 2023
2 parents 29b8b0b + 180afa8 commit 277614d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 19 deletions.
19 changes: 19 additions & 0 deletions docs/en/reference/architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,25 @@ classes, and non-entity classes may extend entity classes.
never calls entity constructors, thus you are free to use them as
you wish and even have it require arguments of any type.

Mapped Superclasses
~~~~~~~~~~~~~~~~~~~

A mapped superclass is an abstract or concrete class that provides
persistent entity state and mapping information for its subclasses,
but which is not itself an entity.

Mapped superclasses are explained in greater detail in the chapter
on :doc:`inheritance mapping <reference/inheritance-mapping>`.

Transient Classes
~~~~~~~~~~~~~~~~~

The term "transient class" appears in some places in the mapping
drivers as well as the code dealing with metadata handling.

A transient class is a class that is neither an entity nor a mapped
superclass. From the ORM's point of view, these classes can be
completely ignored, and no class metadata is loaded for them at all.

Entity states
~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/en/reference/inheritance-mapping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ like this (this is for SQLite):

.. code-block:: sql
CREATE TABLE EntitySubClass (mapped1 INTEGER NOT NULL, mapped2 TEXT NOT NULL, id INTEGER NOT NULL, name TEXT NOT NULL, related1_id INTEGER DEFAULT NULL, PRIMARY KEY(id))
CREATE TABLE Employee (mapped1 INTEGER NOT NULL, mapped2 TEXT NOT NULL, id INTEGER NOT NULL, name TEXT NOT NULL, toothbrush_id INTEGER DEFAULT NULL, PRIMARY KEY(id))
As you can see from this DDL snippet, there is only a single table
for the entity subclass. All the mappings from the mapped
Expand Down
16 changes: 8 additions & 8 deletions lib/Doctrine/ORM/OptimisticLockException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
*/
class OptimisticLockException extends ORMException
{
/** @var object|null */
/** @var object|string|null */
private $entity;

/**
* @param string $msg
* @param object|null $entity
* @param string $msg
* @param object|string|null $entity
*/
public function __construct($msg, $entity)
{
Expand All @@ -30,15 +30,15 @@ public function __construct($msg, $entity)
/**
* Gets the entity that caused the exception.
*
* @return object|null
* @return object|string|null
*/
public function getEntity()
{
return $this->entity;
}

/**
* @param object $entity
* @param object|class-string $entity
*
* @return OptimisticLockException
*/
Expand All @@ -48,9 +48,9 @@ public static function lockFailed($entity)
}

/**
* @param object $entity
* @param int|DateTimeInterface $expectedLockVersion
* @param int|DateTimeInterface $actualLockVersion
* @param object $entity
* @param int|string|DateTimeInterface $expectedLockVersion
* @param int|string|DateTimeInterface $actualLockVersion
*
* @return OptimisticLockException
*/
Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Query/SqlWalker.php

-
message: "#^Parameter \\#1 \\$entity of static method Doctrine\\\\ORM\\\\OptimisticLockException\\:\\:lockFailed\\(\\) expects object, class\\-string\\<object\\> given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/SqlWalker.php

-
message: "#^Result of && is always false\\.$#"
count: 1
Expand Down
3 changes: 1 addition & 2 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2207,12 +2207,11 @@
<ImplicitToStringCast occurrences="1">
<code>$expr</code>
</ImplicitToStringCast>
<InvalidArgument occurrences="5">
<InvalidArgument occurrences="4">
<code>$assoc</code>
<code>$condExpr</code>
<code>$condTerm</code>
<code>$factor</code>
<code>$selectedClass['class']-&gt;name</code>
</InvalidArgument>
<InvalidNullableReturnType occurrences="1">
<code>string</code>
Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public function testIssue(): void
'initialValue' => '',
];

$classMetadataInfo = new ClassMetadata('test_entity');
$classMetadataInfo->setSequenceGeneratorDefinition($parsedDefinition);
$classMetadata = new ClassMetadata('test_entity');
$classMetadata->setSequenceGeneratorDefinition($parsedDefinition);

self::assertSame(
['sequenceName' => 'test_sequence', 'allocationSize' => '1', 'initialValue' => '1'],
$classMetadataInfo->sequenceGeneratorDefinition
$classMetadata->sequenceGeneratorDefinition
);
}
}

0 comments on commit 277614d

Please sign in to comment.