diff --git a/docs/en/reference/architecture.rst b/docs/en/reference/architecture.rst index 3bd844dd8ca..67e1388d9ca 100644 --- a/docs/en/reference/architecture.rst +++ b/docs/en/reference/architecture.rst @@ -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 `. + +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 ~~~~~~~~~~~~~ diff --git a/docs/en/reference/inheritance-mapping.rst b/docs/en/reference/inheritance-mapping.rst index 7c4567f8627..9e5170beb47 100644 --- a/docs/en/reference/inheritance-mapping.rst +++ b/docs/en/reference/inheritance-mapping.rst @@ -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 diff --git a/lib/Doctrine/ORM/OptimisticLockException.php b/lib/Doctrine/ORM/OptimisticLockException.php index f95888c405e..527990fa954 100644 --- a/lib/Doctrine/ORM/OptimisticLockException.php +++ b/lib/Doctrine/ORM/OptimisticLockException.php @@ -16,8 +16,8 @@ class OptimisticLockException extends Exception implements ORMException { /** - * @param string $msg - * @param object|null $entity + * @param string $msg + * @param object|string|null $entity */ public function __construct($msg, private $entity, Throwable|null $previous = null) { @@ -27,7 +27,7 @@ public function __construct($msg, private $entity, Throwable|null $previous = nu /** * Gets the entity that caused the exception. * - * @return object|null + * @return object|string|null */ public function getEntity() { @@ -35,7 +35,7 @@ public function getEntity() } /** - * @param object $entity + * @param object|class-string $entity * * @return OptimisticLockException */ @@ -45,9 +45,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 */ diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ef503bb60bf..33e227e233a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -310,10 +310,6 @@ parameters: count: 2 path: lib/Doctrine/ORM/Query/SqlWalker.php - - - message: "#^Parameter \\#1 \\$entity of static method Doctrine\\\\ORM\\\\OptimisticLockException\\:\\:lockFailed\\(\\) expects object, class\\-string\\ given\\.$#" - count: 1 - path: lib/Doctrine/ORM/Query/SqlWalker.php - message: "#^Parameter \\#3 \\$condExpr of method Doctrine\\\\ORM\\\\Query\\\\SqlWalker\\:\\:walkJoinAssociationDeclaration\\(\\) expects Doctrine\\\\ORM\\\\Query\\\\AST\\\\ConditionalPrimary\\|null, Doctrine\\\\ORM\\\\Query\\\\AST\\\\ConditionalExpression\\|null given\\.$#" diff --git a/psalm-baseline.xml b/psalm-baseline.xml index a2faa413d3a..31906e3082c 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -323,48 +323,6 @@ $class - - - ClassMetadata - ClassMetadata - - - - - $nonSuperclassParents - new $definition['class']() - - - $subClass->table[$indexType][$indexName] - - - $subClass->table - - - $subClass->table[$indexType][$indexName] - - - $parentClass->table[$indexType] - - - $this->em - $this->em - - - getAllClassNames - getConfiguration - getConfiguration - getConfiguration - getConnection - hasListeners - hasListeners - loadMetadataForClass - - - $parent->generatorType - $parent->idGenerator - - $this->columnNames @@ -480,6 +438,42 @@ $this->table + + + $nonSuperclassParents + new $definition['class']() + + + $subClass->table[$indexType][$indexName] + + + $subClass->table + + + $subClass->table[$indexType][$indexName] + + + $parentClass->table[$indexType] + + + $this->em + $this->em + + + getAllClassNames + getConfiguration + getConfiguration + getConfiguration + getConnection + hasListeners + hasListeners + loadMetadataForClass + + + $parent->generatorType + $parent->idGenerator + + new $className() @@ -1346,10 +1340,9 @@ $this->conn->quote((string) $newValue) is_string($expression) - + $assoc $join->conditionalExpression - $selectedClass['class']->name $expr @@ -1555,9 +1548,6 @@ $selectStatement->whereClause->conditionalExpression instanceof ConditionalFactor $selectStatement->whereClause->conditionalExpression instanceof ConditionalPrimary - - static function ($id) use ($connection, $type) { - $selectStatement->whereClause->conditionalExpression diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php index 11a14a0be24..7af662be4a8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php @@ -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, ); } }