mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 15:02:22 +01:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e750360bd5 | ||
|
|
e8ac1169ad | ||
|
|
dd8c7003b8 | ||
|
|
9bec416bb0 | ||
|
|
021722acc7 | ||
|
|
5a528bef5d | ||
|
|
5fbcb18334 | ||
|
|
8280f41fa5 | ||
|
|
d95d8d0a19 | ||
|
|
d36004f825 | ||
|
|
18366db578 | ||
|
|
1b5bef3d4d | ||
|
|
880b622fe6 | ||
|
|
cbf141f7ed | ||
|
|
536bb4f678 | ||
|
|
3f2f42277e | ||
|
|
757d950128 | ||
|
|
f07840b10c | ||
|
|
6e8afeeb60 | ||
|
|
9130b27aca | ||
|
|
2e7c2bb385 | ||
|
|
d69a0fa2cf |
2
.github/workflows/coding-standard.yml
vendored
2
.github/workflows/coding-standard.yml
vendored
@@ -10,4 +10,4 @@ on:
|
||||
|
||||
jobs:
|
||||
coding-standards:
|
||||
uses: "doctrine/.github/.github/workflows/coding-standards.yml@2.0.0"
|
||||
uses: "doctrine/.github/.github/workflows/coding-standards.yml@2.1.0"
|
||||
|
||||
34
.github/workflows/continuous-integration.yml
vendored
34
.github/workflows/continuous-integration.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
uses: "actions/checkout@v3"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
if: "${{ matrix.dbal-version != 'default' }}"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
uses: "ramsey/composer-install@v2"
|
||||
with:
|
||||
composer-options: "--ignore-platform-req=php+"
|
||||
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
ENABLE_SECOND_LEVEL_CACHE: 1
|
||||
|
||||
- name: "Upload coverage file"
|
||||
uses: "actions/upload-artifact@v2"
|
||||
uses: "actions/upload-artifact@v3"
|
||||
with:
|
||||
name: "phpunit-sqlite-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
|
||||
path: "coverage*.xml"
|
||||
@@ -110,7 +110,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
uses: "actions/checkout@v3"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
@@ -126,7 +126,7 @@ jobs:
|
||||
if: "${{ matrix.dbal-version != 'default' }}"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
uses: "ramsey/composer-install@v2"
|
||||
with:
|
||||
composer-options: "--ignore-platform-req=php+"
|
||||
|
||||
@@ -134,7 +134,7 @@ jobs:
|
||||
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml --coverage-clover=coverage.xml"
|
||||
|
||||
- name: "Upload coverage file"
|
||||
uses: "actions/upload-artifact@v2"
|
||||
uses: "actions/upload-artifact@v3"
|
||||
with:
|
||||
name: "${{ github.job }}-${{ matrix.postgres-version }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
|
||||
path: "coverage.xml"
|
||||
@@ -185,7 +185,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
uses: "actions/checkout@v3"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
@@ -202,7 +202,7 @@ jobs:
|
||||
extensions: "${{ matrix.extension }}"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
uses: "ramsey/composer-install@v2"
|
||||
with:
|
||||
composer-options: "--ignore-platform-req=php+"
|
||||
|
||||
@@ -210,7 +210,7 @@ jobs:
|
||||
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
|
||||
|
||||
- name: "Upload coverage file"
|
||||
uses: "actions/upload-artifact@v2"
|
||||
uses: "actions/upload-artifact@v3"
|
||||
with:
|
||||
name: "${{ github.job }}-${{ matrix.mariadb-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
|
||||
path: "coverage.xml"
|
||||
@@ -261,7 +261,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
uses: "actions/checkout@v3"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
@@ -278,7 +278,7 @@ jobs:
|
||||
if: "${{ matrix.dbal-version != 'default' }}"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
uses: "ramsey/composer-install@v2"
|
||||
with:
|
||||
composer-options: "--ignore-platform-req=php+"
|
||||
|
||||
@@ -293,7 +293,7 @@ jobs:
|
||||
ENABLE_SECOND_LEVEL_CACHE: 1
|
||||
|
||||
- name: "Upload coverage files"
|
||||
uses: "actions/upload-artifact@v2"
|
||||
uses: "actions/upload-artifact@v3"
|
||||
with:
|
||||
name: "${{ github.job }}-${{ matrix.mysql-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
|
||||
path: "coverage*.xml"
|
||||
@@ -313,7 +313,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
uses: "actions/checkout@v3"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
@@ -324,7 +324,7 @@ jobs:
|
||||
ini-values: "zend.assertions=1"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
uses: "ramsey/composer-install@v2"
|
||||
with:
|
||||
dependency-versions: "${{ matrix.deps }}"
|
||||
|
||||
@@ -343,16 +343,16 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
uses: "actions/checkout@v3"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: "Download coverage files"
|
||||
uses: "actions/download-artifact@v2"
|
||||
uses: "actions/download-artifact@v3"
|
||||
with:
|
||||
path: "reports"
|
||||
|
||||
- name: "Upload to Codecov"
|
||||
uses: "codecov/codecov-action@v1"
|
||||
uses: "codecov/codecov-action@v3"
|
||||
with:
|
||||
directory: reports
|
||||
|
||||
4
.github/workflows/phpbench.yml
vendored
4
.github/workflows/phpbench.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
uses: "actions/checkout@v3"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
ini-values: "zend.assertions=1"
|
||||
|
||||
- name: "Cache dependencies installed with composer"
|
||||
uses: "actions/cache@v2"
|
||||
uses: "actions/cache@v3"
|
||||
with:
|
||||
path: "~/.composer/cache"
|
||||
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
|
||||
|
||||
@@ -7,7 +7,7 @@ on:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@2.0.0"
|
||||
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@2.1.0"
|
||||
secrets:
|
||||
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
|
||||
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
|
||||
|
||||
8
.github/workflows/static-analysis.yml
vendored
8
.github/workflows/static-analysis.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: "actions/checkout@v2"
|
||||
uses: "actions/checkout@v3"
|
||||
|
||||
- name: "Install PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
if: "${{ matrix.persistence-version != 'default' }}"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
uses: "ramsey/composer-install@v2"
|
||||
with:
|
||||
dependency-versions: "highest"
|
||||
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: "actions/checkout@v2"
|
||||
uses: "actions/checkout@v3"
|
||||
|
||||
- name: "Install PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
uses: "ramsey/composer-install@v2"
|
||||
with:
|
||||
dependency-versions: "highest"
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ annotation metadata supported since the first version 2.0.
|
||||
Index
|
||||
-----
|
||||
|
||||
- :ref:`#[AssociationOverride] <attrref_associationoverride]`
|
||||
- :ref:`#[AttributeOverride] <attrref_attributeoverride]`
|
||||
- :ref:`#[AssociationOverride] <attrref_associationoverride>`
|
||||
- :ref:`#[AttributeOverride] <attrref_attributeoverride>`
|
||||
- :ref:`#[Column] <attrref_column>`
|
||||
- :ref:`#[Cache] <attrref_cache>`
|
||||
- :ref:`#[ChangeTrackingPolicy <attrref_changetrackingpolicy>`
|
||||
@@ -27,7 +27,6 @@ Index
|
||||
- :ref:`#[Id] <attrref_id>`
|
||||
- :ref:`#[InheritanceType] <attrref_inheritancetype>`
|
||||
- :ref:`#[JoinColumn] <attrref_joincolumn>`
|
||||
- :ref:`#[JoinColumns] <attrref_joincolumns>`
|
||||
- :ref:`#[JoinTable] <attrref_jointable>`
|
||||
- :ref:`#[ManyToOne] <attrref_manytoone>`
|
||||
- :ref:`#[ManyToMany] <attrref_manytomany>`
|
||||
@@ -179,7 +178,7 @@ Optional parameters:
|
||||
If not specified, default value is ``false``.
|
||||
|
||||
- **insertable**: Boolean value to determine if the column should be
|
||||
included when inserting a new row into the underlying entities table.
|
||||
included when inserting a new row into the underlying entities table.
|
||||
If not specified, default value is true.
|
||||
|
||||
- **updatable**: Boolean value to determine if the column should be
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Separating Concerns using Embeddables
|
||||
-------------------------------------
|
||||
=====================================
|
||||
|
||||
Embeddables are classes which are not entities themselves, but are embedded
|
||||
in entities and can also be queried in DQL. You'll mostly want to use them
|
||||
|
||||
@@ -464,14 +464,14 @@ abstract class AbstractHydrator
|
||||
break;
|
||||
}
|
||||
|
||||
if ($value !== null && isset($cacheKeyInfo['enumType'])) {
|
||||
$value = $this->buildEnum($value, $cacheKeyInfo['enumType']);
|
||||
}
|
||||
|
||||
$rowData['data'][$dqlAlias][$fieldName] = $type
|
||||
? $type->convertToPHPValue($value, $this->_platform)
|
||||
: $value;
|
||||
|
||||
if ($rowData['data'][$dqlAlias][$fieldName] !== null && isset($cacheKeyInfo['enumType'])) {
|
||||
$rowData['data'][$dqlAlias][$fieldName] = $this->buildEnum($rowData['data'][$dqlAlias][$fieldName], $cacheKeyInfo['enumType']);
|
||||
}
|
||||
|
||||
if ($cacheKeyInfo['isIdentifier'] && $value !== null) {
|
||||
$id[$dqlAlias] .= '|' . $value;
|
||||
$nonemptyComponents[$dqlAlias] = true;
|
||||
|
||||
@@ -76,12 +76,11 @@ class LazyCriteriaCollection extends AbstractLazyCollection implements Selectabl
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Do an optimized search of an element
|
||||
*
|
||||
* @param object $element
|
||||
* @psalm-param TValue $element
|
||||
*
|
||||
* @return bool
|
||||
* @template TMaybeContained
|
||||
*/
|
||||
public function contains($element)
|
||||
{
|
||||
|
||||
@@ -63,8 +63,8 @@ class ReflectionEnumProperty extends ReflectionProperty
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $object
|
||||
* @param int|string|int[]|string[]|null $value
|
||||
* @param object $object
|
||||
* @param int|string|int[]|string[]|BackedEnum|BackedEnum[]|null $value
|
||||
*/
|
||||
public function setValue($object, $value = null): void
|
||||
{
|
||||
@@ -82,11 +82,15 @@ class ReflectionEnumProperty extends ReflectionProperty
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $object
|
||||
* @param int|string $value
|
||||
* @param object $object
|
||||
* @param int|string|BackedEnum $value
|
||||
*/
|
||||
private function initializeEnumValue($object, $value): BackedEnum
|
||||
{
|
||||
if ($value instanceof BackedEnum) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$enumType = $this->enumType;
|
||||
|
||||
try {
|
||||
|
||||
@@ -393,6 +393,8 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @template TMaybeContained
|
||||
*/
|
||||
public function contains($element): bool
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ class SqlValueVisitor extends ExpressionVisitor
|
||||
/**
|
||||
* Converts a comparison expression into the target query language output.
|
||||
*
|
||||
* @return void
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function walkComparison(Comparison $comparison)
|
||||
{
|
||||
@@ -32,35 +32,39 @@ class SqlValueVisitor extends ExpressionVisitor
|
||||
$operator = $comparison->getOperator();
|
||||
|
||||
if (($operator === Comparison::EQ || $operator === Comparison::IS) && $value === null) {
|
||||
return;
|
||||
return null;
|
||||
} elseif ($operator === Comparison::NEQ && $value === null) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->values[] = $value;
|
||||
$this->types[] = [$field, $value, $operator];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a composite expression into the target query language output.
|
||||
*
|
||||
* @return void
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function walkCompositeExpression(CompositeExpression $expr)
|
||||
{
|
||||
foreach ($expr->getExpressionList() as $child) {
|
||||
$this->dispatch($child);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a value expression into the target query language part.
|
||||
*
|
||||
* @return void
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function walkValue(Value $value)
|
||||
{
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -527,11 +527,12 @@ public function __construct(<params>)
|
||||
* Sets the class fields visibility for the entity (can either be private or protected).
|
||||
*
|
||||
* @param string $visibility
|
||||
* @psalm-param self::FIELD_VISIBLE_*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @psalm-assert self::FIELD_VISIBLE_* $visibility
|
||||
*/
|
||||
public function setFieldVisibility($visibility)
|
||||
{
|
||||
|
||||
@@ -500,7 +500,7 @@
|
||||
</RedundantCastGivenDocblockType>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Mapping/ClassMetadata.php">
|
||||
<PropertyNotSetInConstructor occurrences="5">
|
||||
<PropertyNotSetInConstructor occurrences="4">
|
||||
<code>ClassMetadata</code>
|
||||
<code>ClassMetadata</code>
|
||||
<code>ClassMetadata</code>
|
||||
@@ -525,10 +525,6 @@
|
||||
<code>addNamedNativeQuery</code>
|
||||
<code>addNamedQuery</code>
|
||||
</DeprecatedMethod>
|
||||
<DocblockTypeContradiction occurrences="2">
|
||||
<code>! $definition</code>
|
||||
<code>$definition</code>
|
||||
</DocblockTypeContradiction>
|
||||
<InvalidArrayOffset occurrences="1">
|
||||
<code>$subClass->table[$indexType][$indexName]</code>
|
||||
</InvalidArrayOffset>
|
||||
@@ -661,10 +657,9 @@
|
||||
<code>$this->associationMappings[$idProperty]['joinColumns']</code>
|
||||
<code>$this->associationMappings[$idProperty]['joinColumns']</code>
|
||||
</PossiblyUndefinedArrayOffset>
|
||||
<PropertyNotSetInConstructor occurrences="5">
|
||||
<PropertyNotSetInConstructor occurrences="4">
|
||||
<code>$idGenerator</code>
|
||||
<code>$namespace</code>
|
||||
<code>$sequenceGeneratorDefinition</code>
|
||||
<code>$table</code>
|
||||
<code>$tableGeneratorDefinition</code>
|
||||
</PropertyNotSetInConstructor>
|
||||
@@ -2718,9 +2713,6 @@
|
||||
<DocblockTypeContradiction occurrences="1">
|
||||
<code>class_exists($metadata->name)</code>
|
||||
</DocblockTypeContradiction>
|
||||
<InvalidDocblock occurrences="1">
|
||||
<code>public function setFieldVisibility($visibility)</code>
|
||||
</InvalidDocblock>
|
||||
<PossiblyFalseArgument occurrences="2">
|
||||
<code>$last</code>
|
||||
<code>strrpos($metadata->name, '\\')</code>
|
||||
@@ -2735,9 +2727,7 @@
|
||||
<code>(array) $metadata->table['options']</code>
|
||||
<code>(bool) $embeddablesImmutable</code>
|
||||
</RedundantCastGivenDocblockType>
|
||||
<RedundantConditionGivenDocblockType occurrences="3">
|
||||
<code>$metadata->sequenceGeneratorDefinition</code>
|
||||
<code>$metadata->sequenceGeneratorDefinition</code>
|
||||
<RedundantConditionGivenDocblockType occurrences="1">
|
||||
<code>isset($metadata->lifecycleCallbacks)</code>
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</file>
|
||||
@@ -2840,10 +2830,9 @@
|
||||
<code>$field['associationKey']</code>
|
||||
<code>isset($field['associationKey']) && $field['associationKey']</code>
|
||||
</RedundantCondition>
|
||||
<RedundantConditionGivenDocblockType occurrences="4">
|
||||
<RedundantConditionGivenDocblockType occurrences="3">
|
||||
<code>$metadata->inheritanceType</code>
|
||||
<code>$metadata->inheritanceType</code>
|
||||
<code>$sequenceDefinition</code>
|
||||
<code>isset($metadata->lifecycleCallbacks)</code>
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</file>
|
||||
|
||||
@@ -92,6 +92,8 @@
|
||||
<!-- DBAL 3.2 forward compatibility -->
|
||||
<file name="lib/Doctrine/ORM/Tools/Pagination/CountOutputWalker.php"/>
|
||||
<file name="lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php"/>
|
||||
<!-- https://github.com/vimeo/psalm/issues/8520 -->
|
||||
<file name="lib/Doctrine/ORM/PersistentCollection.php"/>
|
||||
</errorLevel>
|
||||
</DocblockTypeContradiction>
|
||||
<InvalidArgument>
|
||||
|
||||
@@ -51,7 +51,7 @@ class City
|
||||
* @JoinColumn(name="state_id", referencedColumnName="id")
|
||||
*/
|
||||
#[ORM\Cache]
|
||||
#[ORM\ManyToOne(targetEntity: 'State', inversedBy: 'citities')]
|
||||
#[ORM\ManyToOne(targetEntity: 'State', inversedBy: 'cities')]
|
||||
#[ORM\JoinColumn(name: 'state_id', referencedColumnName: 'id')]
|
||||
protected $state;
|
||||
|
||||
|
||||
@@ -66,6 +66,58 @@ class EnumTest extends OrmFunctionalTestCase
|
||||
$this->assertEquals(Suit::Clubs, $fetchedCard->suit);
|
||||
}
|
||||
|
||||
public function testEnumHydrationObjectHydrator(): void
|
||||
{
|
||||
$this->setUpEntitySchema([Card::class]);
|
||||
|
||||
$card1 = new Card();
|
||||
$card1->suit = Suit::Clubs;
|
||||
$card2 = new Card();
|
||||
$card2->suit = Suit::Hearts;
|
||||
|
||||
$this->_em->persist($card1);
|
||||
$this->_em->persist($card2);
|
||||
$this->_em->flush();
|
||||
|
||||
unset($card1, $card2);
|
||||
$this->_em->clear();
|
||||
|
||||
/** @var list<Card> $foundCards */
|
||||
$foundCards = $this->_em->createQueryBuilder()
|
||||
->select('c')
|
||||
->from(Card::class, 'c')
|
||||
->where('c.suit = :suit')
|
||||
->setParameter('suit', Suit::Clubs)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
self::assertNotEmpty($foundCards);
|
||||
foreach ($foundCards as $card) {
|
||||
self::assertSame(Suit::Clubs, $card->suit);
|
||||
}
|
||||
}
|
||||
|
||||
public function testEnumArrayHydrationObjectHydrator(): void
|
||||
{
|
||||
$this->setUpEntitySchema([Scale::class]);
|
||||
|
||||
$scale = new Scale();
|
||||
$scale->supportedUnits = [Unit::Gram, Unit::Meter];
|
||||
|
||||
$this->_em->persist($scale);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$result = $this->_em->createQueryBuilder()
|
||||
->from(Scale::class, 's')
|
||||
->select('s')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
self::assertInstanceOf(Scale::class, $result[0]);
|
||||
self::assertEqualsCanonicalizing([Unit::Gram, Unit::Meter], $result[0]->supportedUnits);
|
||||
}
|
||||
|
||||
public function testEnumHydration(): void
|
||||
{
|
||||
$this->setUpEntitySchema([Card::class, CardWithNullable::class]);
|
||||
|
||||
@@ -125,7 +125,7 @@ class DDC5684Object
|
||||
/**
|
||||
* @var DDC5684ObjectIdType
|
||||
* @Id
|
||||
* @Column(type=Doctrine\Tests\ORM\Functional\Ticket\DDC5684ObjectIdType::class)
|
||||
* @Column(type=DDC5684ObjectIdType::class)
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
@@ -153,8 +153,8 @@ class GH6141People
|
||||
* @InheritanceType("JOINED")
|
||||
* @DiscriminatorColumn(name="discr", type="gh6141people")
|
||||
* @DiscriminatorMap({
|
||||
* Doctrine\Tests\ORM\Functional\Ticket\GH6141People::BOSS = GH6141Boss::class,
|
||||
* Doctrine\Tests\ORM\Functional\Ticket\GH6141People::EMPLOYEE = GH6141Employee::class
|
||||
* GH6141People::BOSS = GH6141Boss::class,
|
||||
* GH6141People::EMPLOYEE = GH6141Employee::class
|
||||
* })
|
||||
*/
|
||||
abstract class GH6141Person
|
||||
|
||||
@@ -58,7 +58,7 @@ class GH7012UserData
|
||||
/**
|
||||
* @var QuotedUser
|
||||
* @Id
|
||||
* @OneToOne(targetEntity=Doctrine\Tests\Models\Quote\User::class)
|
||||
* @OneToOne(targetEntity=QuotedUser::class)
|
||||
* @JoinColumn(name="`user-id`", referencedColumnName="`user-id`", onDelete="CASCADE")
|
||||
*/
|
||||
public $user;
|
||||
|
||||
@@ -48,8 +48,8 @@ class GH7512Test extends OrmFunctionalTestCase
|
||||
* @Entity()
|
||||
* @InheritanceType("JOINED")
|
||||
* @DiscriminatorMap({
|
||||
* "entitya"=Doctrine\Tests\ORM\Functional\Ticket\GH7512EntityA::class,
|
||||
* "entityB"=Doctrine\Tests\ORM\Functional\Ticket\GH7512EntityB::class
|
||||
* "entitya"=GH7512EntityA::class,
|
||||
* "entityB"=GH7512EntityB::class
|
||||
* })
|
||||
*/
|
||||
class GH7512EntityA
|
||||
@@ -63,7 +63,7 @@ class GH7512EntityA
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="Doctrine\Tests\ORM\Functional\Ticket\GH7512EntityC", mappedBy="entityA")
|
||||
* @OneToMany(targetEntity="GH7512EntityC", mappedBy="entityA")
|
||||
* @var Collection<int, GH7512EntityC>
|
||||
*/
|
||||
public $entityCs;
|
||||
@@ -86,7 +86,7 @@ class GH7512EntityC
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="Doctrine\Tests\ORM\Functional\Ticket\GH7512EntityA", inversedBy="entityCs")
|
||||
* @ManyToOne(targetEntity="GH7512EntityA", inversedBy="entityCs")
|
||||
* @var GH7512EntityA
|
||||
*/
|
||||
public $entityA;
|
||||
|
||||
@@ -21,6 +21,8 @@ use stdClass;
|
||||
use function array_keys;
|
||||
use function assert;
|
||||
use function method_exists;
|
||||
use function serialize;
|
||||
use function unserialize;
|
||||
|
||||
/**
|
||||
* Tests the lazy-loading capabilities of the PersistentCollection and the initialization of collections.
|
||||
@@ -286,4 +288,13 @@ class PersistentCollectionTest extends OrmTestCase
|
||||
|
||||
$this->collection->clear();
|
||||
}
|
||||
|
||||
public function testItCanBeSerializedAndUnserializedBack(): void
|
||||
{
|
||||
$this->collection->add(new stdClass());
|
||||
$collection = unserialize(serialize($this->collection));
|
||||
$collection->add(new stdClass());
|
||||
$collection[3] = new stdClass();
|
||||
self::assertCount(3, $collection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ class DDC1649Two
|
||||
{
|
||||
/**
|
||||
* @var DDC1649One
|
||||
* @Id @ManyToOne(targetEntity="DDC1649One")@JoinColumn(name="id", referencedColumnName="id")
|
||||
* @Id @ManyToOne(targetEntity="DDC1649One")
|
||||
*/
|
||||
public $one;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user