diff -Nru doctrine-2.7.1/debian/changelog doctrine-2.7.2/debian/changelog --- doctrine-2.7.1/debian/changelog 2020-02-23 19:57:26.000000000 +0000 +++ doctrine-2.7.2/debian/changelog 2020-03-27 05:45:53.000000000 +0000 @@ -1,3 +1,9 @@ +doctrine (2.7.2-1) unstable; urgency=medium + + * New upstream release + + -- David Prévot Thu, 26 Mar 2020 19:45:53 -1000 + doctrine (2.7.1-1) unstable; urgency=medium [ Luís Cobucci ] diff -Nru doctrine-2.7.1/debian/patches/0003-Compatibility-with-recent-PHPUnit-8.patch doctrine-2.7.2/debian/patches/0003-Compatibility-with-recent-PHPUnit-8.patch --- doctrine-2.7.1/debian/patches/0003-Compatibility-with-recent-PHPUnit-8.patch 2020-02-23 19:57:26.000000000 +0000 +++ doctrine-2.7.2/debian/patches/0003-Compatibility-with-recent-PHPUnit-8.patch 2020-03-27 05:45:53.000000000 +0000 @@ -99,7 +99,7 @@ .../Functional/SecondLevelCacheConcurrentTest.php | 4 ++-- .../SecondLevelCacheExtraLazyCollectionTest.php | 4 ++-- .../Functional/SecondLevelCacheManyToManyTest.php | 6 ++--- - .../Functional/SecondLevelCacheQueryCacheTest.php | 18 +++++---------- + .../Functional/SecondLevelCacheQueryCacheTest.php | 24 +++++++------------- .../SequenceEmulatedIdentityStrategyTest.php | 4 ++-- .../Tests/ORM/Functional/SequenceGeneratorTest.php | 2 +- .../ORM/Functional/SingleTableCompositeKeyTest.php | 2 +- @@ -288,6 +288,7 @@ .../Tests/ORM/Functional/Ticket/GH7286Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH7366Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH7829Test.php | 2 +- + .../Tests/ORM/Functional/Ticket/GH8031Test.php | 2 +- .../Tests/ORM/Functional/Ticket/Issue5989Test.php | 2 +- .../Tests/ORM/Functional/Ticket/Ticket2481Test.php | 2 +- .../Tests/ORM/Functional/Ticket/Ticket69.php | 2 +- @@ -364,7 +365,7 @@ .../Tests/ORM/Utility/IdentifierFlattenerTest.php | 2 +- tests/Doctrine/Tests/OrmFunctionalTestCase.php | 6 ++--- tests/Doctrine/Tests/VerifyDeprecations.php | 2 +- - 361 files changed, 435 insertions(+), 465 deletions(-) + 362 files changed, 438 insertions(+), 470 deletions(-) diff --git a/tests/Doctrine/Tests/DbalFunctionalTestCase.php b/tests/Doctrine/Tests/DbalFunctionalTestCase.php index 0be58ed..deb19ad 100644 @@ -1863,7 +1864,7 @@ $this->loadFixturesCountries(); diff --git a/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php b/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php -index 0a32886..f48582b 100644 +index 56188ad..ab6f732 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php @@ -1085,12 +1085,10 @@ class SecondLevelCacheQueryCacheTest extends SecondLevelCacheAbstractTest @@ -1881,7 +1882,22 @@ $this->evictRegions(); $this->loadFixturesCountries(); -@@ -1100,23 +1098,19 @@ class SecondLevelCacheQueryCacheTest extends SecondLevelCacheAbstractTest +@@ -1099,12 +1097,10 @@ class SecondLevelCacheQueryCacheTest extends SecondLevelCacheAbstractTest + ->getResult(); + } + +- /** +- * @expectedException \Doctrine\ORM\Cache\CacheException +- * @expectedExceptionMessage Second level cache does not support partial entities. +- */ + public function testCacheableForcePartialLoadHintQueryException() + { ++ $this->expectException(\Doctrine\ORM\Cache\CacheException::class); ++ $this->expectExceptionMessage('Second level cache does not support partial entities.'); + $this->evictRegions(); + $this->loadFixturesCountries(); + +@@ -1114,23 +1110,19 @@ class SecondLevelCacheQueryCacheTest extends SecondLevelCacheAbstractTest ->getResult(); } @@ -4512,6 +4528,19 @@ { $this->useModelSet('cms'); parent::setUp(); +diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php +index 7ae17d3..bb18d93 100644 +--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php ++++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php +@@ -8,7 +8,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; + + class GH8031Test extends OrmFunctionalTestCase + { +- protected function setUp() ++ protected function setUp(): void + { + parent::setUp(); + diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Issue5989Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Issue5989Test.php index cf601b9..f1ec8d3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Issue5989Test.php diff -Nru doctrine-2.7.1/debian/patches/0005-Update-version.patch doctrine-2.7.2/debian/patches/0005-Update-version.patch --- doctrine-2.7.1/debian/patches/0005-Update-version.patch 1970-01-01 00:00:00.000000000 +0000 +++ doctrine-2.7.2/debian/patches/0005-Update-version.patch 2020-03-27 05:45:53.000000000 +0000 @@ -0,0 +1,22 @@ +From: =?utf-8?q?David_Pr=C3=A9vot?= +Date: Thu, 26 Mar 2020 19:45:14 -1000 +Subject: Update version + +Forwarded: not-needed +--- + lib/Doctrine/ORM/Version.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/Doctrine/ORM/Version.php b/lib/Doctrine/ORM/Version.php +index aa286eb..faddb77 100644 +--- a/lib/Doctrine/ORM/Version.php ++++ b/lib/Doctrine/ORM/Version.php +@@ -37,7 +37,7 @@ class Version + /** + * Current Doctrine Version + */ +- const VERSION = '2.7.1-DEV'; ++ const VERSION = '2.7.2'; + + /** + * Compares a Doctrine version with the current one. diff -Nru doctrine-2.7.1/debian/patches/series doctrine-2.7.2/debian/patches/series --- doctrine-2.7.1/debian/patches/series 2020-02-23 19:57:26.000000000 +0000 +++ doctrine-2.7.2/debian/patches/series 2020-03-27 05:45:53.000000000 +0000 @@ -2,3 +2,4 @@ 0002-Use-system-path-instead-of-Composer-one.patch 0003-Compatibility-with-recent-PHPUnit-8.patch 0004-Workaround-the-lack-of-PackageVersions.patch +0005-Update-version.patch diff -Nru doctrine-2.7.1/debian/upstream/changelog doctrine-2.7.2/debian/upstream/changelog --- doctrine-2.7.1/debian/upstream/changelog 2020-02-23 19:40:28.000000000 +0000 +++ doctrine-2.7.2/debian/upstream/changelog 2020-03-27 05:45:53.000000000 +0000 @@ -1,3 +1,63 @@ +v2.7.2 - Mar 21, 2020 + + Total issues resolved: 4 + Total pull requests resolved: 5 + Total contributors: 8 + +Documentation + + 8041: Improve documentation about naming strategy usage thanks to @RosemaryOrchard + +Bug + + 8031: Undefined alias for Embeddable in 2.7.1 thanks to @vicdelfant + 8030: Problem with Proxies on PHP 7.4.2 with typed properties thanks to @bizley + 8023: Put into cache using root entity name thanks to @peterkeatingie + 7969: Child entity not retrieved from array cache thanks to @peterkeatingie + 8055: Fix regression in 2.7.1 when mysqli is used with discriminator column that is not a string thanks to @mpdude + 8050: [GH-7633] disallow cache partial objects thanks to @beberlei + 8036: Fix inherited embeddables and nesting after AnnotationDriver change #8006 thanks to @malarzm + 7633: Partial objects get cached and break "actual" objects thanks to @Amunak + + +v2.7.1 - Feb 15, 2020 + +A notable change of this version is the introduction of ocramius/package-versions to provide version information, most importantly when using the +Doctrine CLI. That also means that you cannot rely on Doctrine\ORM\Version::VERSION constant anymore going forward it will always point to 2.7.1-DEV. + + Total issues resolved: 4 + Total pull requests resolved: 11 + Total contributors: 11 + +Bug + + 8006: Make Embeddable not transient thanks to @malarzm + 7987: [GH-7982] no sql executor leads to parse error thanks to @beberlei + 7983: Null offset access in DQL parser thanks to @ntzm + 7974: [GH-7505] Bug in SimpleObjectHydrator when using inheritance with same field thanks to @beberlei and @m-r-r + 7940: [GH-7864] Bugfix in PersistentCollection::removeElement for EXTRA_LAZY. thanks to @beberlei + 7934: Fix Trying to access array offset on value of type null thanks to @BenMorel + 7957: Fix version information thanks to @lcobucci + +Documentation + + 7973: Just a micro grammar update. thanks to @DocFX + 7619: Update improving-performance.rst to reflect current state of PHP ecosystem thanks to @Majkl578 + 7500: Prefer PhpFileCache for caching docs thanks to @shadowhand + +CI,Deprecation + + 7956: Ignore Doctrine\Common\Persistence\ObjectManagerDecorator deprecation thanks to @lcobucci + +Bug,Regression + + 7937: Revert SchemaTool change to check for foreign key support thanks to @beberlei and @fmathieu1 + +BC Break,Bug + + 7875: Whilelist existing assets we know about from metadata in SchemaTool::getUpdateSchemaSql() thanks to @nicolas-grekas + + v2.7.0 - Nov 19, 2019 This release solves Symfony 5.0 compatibility issues, some small improvements, and adds various deprecation notices. diff -Nru doctrine-2.7.1/lib/Doctrine/ORM/Cache/DefaultQueryCache.php doctrine-2.7.2/lib/Doctrine/ORM/Cache/DefaultQueryCache.php --- doctrine-2.7.1/lib/Doctrine/ORM/Cache/DefaultQueryCache.php 2020-02-23 19:38:29.000000000 +0000 +++ doctrine-2.7.2/lib/Doctrine/ORM/Cache/DefaultQueryCache.php 2020-03-27 05:24:23.000000000 +0000 @@ -260,7 +260,7 @@ throw new CacheException("Second-level cache query supports only select statements."); } - if (isset($hints[Query::HINT_FORCE_PARTIAL_LOAD]) && $hints[Query::HINT_FORCE_PARTIAL_LOAD]) { + if (($hints[Query\SqlWalker::HINT_PARTIAL] ?? false) === true || ($hints[Query::HINT_FORCE_PARTIAL_LOAD] ?? false) === true) { throw new CacheException("Second level cache does not support partial entities."); } @@ -279,9 +279,12 @@ $region = $persister->getCacheRegion(); + $cm = $this->em->getClassMetadata($entityName); + assert($cm instanceof ClassMetadata); + foreach ($result as $index => $entity) { - $identifier = $this->uow->getEntityIdentifier($entity); - $entityKey = new EntityCacheKey($entityName, $identifier); + $identifier = $this->uow->getEntityIdentifier($entity); + $entityKey = new EntityCacheKey($cm->rootEntityName, $identifier); if (($key->cacheMode & Cache::MODE_REFRESH) || ! $region->contains($entityKey)) { // Cancel put result if entity put fail diff -Nru doctrine-2.7.1/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php doctrine-2.7.2/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php --- doctrine-2.7.1/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php 2020-02-23 19:38:29.000000000 +0000 +++ doctrine-2.7.2/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php 2020-03-27 05:24:23.000000000 +0000 @@ -138,7 +138,7 @@ // Prevent overwrite in case of inherit classes using same property name (See AbstractHydrator) if ( ! isset($data[$fieldName]) || ! $valueIsNull) { // If we have inheritance in resultset, make sure the field belongs to the correct class - if (isset($cacheKeyInfo['discriminatorValues']) && ! in_array($discrColumnValue, $cacheKeyInfo['discriminatorValues'], true)) { + if (isset($cacheKeyInfo['discriminatorValues']) && ! in_array((string) $discrColumnValue, $cacheKeyInfo['discriminatorValues'], true)) { continue; } diff -Nru doctrine-2.7.1/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php doctrine-2.7.2/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php --- doctrine-2.7.1/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php 2020-02-23 19:38:29.000000000 +0000 +++ doctrine-2.7.2/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php 2020-03-27 05:24:23.000000000 +0000 @@ -31,6 +31,7 @@ use Doctrine\ORM\Id\IdentityGenerator; use Doctrine\ORM\ORMException; use ReflectionException; +use function assert; /** * The ClassMetadataFactory is used to create ClassMetadata objects that contain all the @@ -401,10 +402,10 @@ private function addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass) { foreach ($parentClass->fieldMappings as $mapping) { - if ( ! isset($mapping['inherited']) && ! $parentClass->isMappedSuperclass) { + if (! isset($mapping['inherited']) && ! $parentClass->isMappedSuperclass && ! $parentClass->isEmbeddedClass) { $mapping['inherited'] = $parentClass->name; } - if ( ! isset($mapping['declared'])) { + if (! isset($mapping['declared'])) { $mapping['declared'] = $parentClass->name; } $subClass->addInheritedFieldMapping($mapping); @@ -469,10 +470,6 @@ private function addNestedEmbeddedClasses(ClassMetadata $subClass, ClassMetadata $parentClass, $prefix) { foreach ($subClass->embeddedClasses as $property => $embeddableClass) { - if (isset($embeddableClass['inherited'])) { - continue; - } - $embeddableMetadata = $this->getMetadataFor($embeddableClass['class']); $parentClass->mapEmbedded( @@ -780,7 +777,9 @@ */ protected function isEntity(ClassMetadataInterface $class) { - return isset($class->isMappedSuperclass) && $class->isMappedSuperclass === false; + assert($class instanceof ClassMetadata); + + return $class->isMappedSuperclass === false && $class->isEmbeddedClass === false; } /** diff -Nru doctrine-2.7.1/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php doctrine-2.7.2/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php --- doctrine-2.7.1/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php 2020-02-23 19:38:29.000000000 +0000 +++ doctrine-2.7.2/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php 2020-03-27 05:24:23.000000000 +0000 @@ -278,6 +278,8 @@ foreach ($class->getProperties() as $property) { if ($metadata->isMappedSuperclass && ! $property->isPrivate() || + $metadata->isEmbeddedClass && $property->getDeclaringClass()->getName() !== $class->getName() + || $metadata->isInheritedField($property->name) || $metadata->isInheritedAssociation($property->name) diff -Nru doctrine-2.7.1/lib/Doctrine/ORM/Query/SqlWalker.php doctrine-2.7.2/lib/Doctrine/ORM/Query/SqlWalker.php --- doctrine-2.7.1/lib/Doctrine/ORM/Query/SqlWalker.php 2020-02-23 19:38:29.000000000 +0000 +++ doctrine-2.7.2/lib/Doctrine/ORM/Query/SqlWalker.php 2020-03-27 05:24:23.000000000 +0000 @@ -47,6 +47,11 @@ const HINT_DISTINCT = 'doctrine.distinct'; /** + * Used to mark a query as containing a PARTIAL expression, which needs to be known by SLC. + */ + public const HINT_PARTIAL = 'doctrine.partial'; + + /** * @var ResultSetMapping */ private $rsm; @@ -1366,6 +1371,8 @@ default: // IdentificationVariable or PartialObjectExpression if ($expr instanceof AST\PartialObjectExpression) { + $this->query->setHint(self::HINT_PARTIAL, true); + $dqlAlias = $expr->identificationVariable; $partialFieldSet = $expr->partialFieldSet; } else { diff -Nru doctrine-2.7.1/lib/Doctrine/ORM/QueryBuilder.php doctrine-2.7.2/lib/Doctrine/ORM/QueryBuilder.php --- doctrine-2.7.1/lib/Doctrine/ORM/QueryBuilder.php 2020-02-23 19:38:29.000000000 +0000 +++ doctrine-2.7.2/lib/Doctrine/ORM/QueryBuilder.php 2020-03-27 05:24:23.000000000 +0000 @@ -100,7 +100,7 @@ /** * The index of the first result to retrieve. * - * @var integer + * @var int|null */ private $_firstResult = null; @@ -616,7 +616,7 @@ /** * Sets the position of the first result to retrieve (the "offset"). * - * @param integer $firstResult The first result to return. + * @param int|null $firstResult The first result to return. * * @return self */ @@ -631,7 +631,7 @@ * Gets the position of the first result the query object was set to retrieve (the "offset"). * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder. * - * @return integer The position of the first result. + * @return int|null The position of the first result. */ public function getFirstResult() { diff -Nru doctrine-2.7.1/lib/Doctrine/ORM/Query.php doctrine-2.7.2/lib/Doctrine/ORM/Query.php --- doctrine-2.7.1/lib/Doctrine/ORM/Query.php 2020-02-23 19:38:29.000000000 +0000 +++ doctrine-2.7.2/lib/Doctrine/ORM/Query.php 2020-03-27 05:24:23.000000000 +0000 @@ -624,7 +624,7 @@ /** * Sets the position of the first result to retrieve (the "offset"). * - * @param integer $firstResult The first result to return. + * @param int|null $firstResult The first result to return. * * @return Query This query object. */ diff -Nru doctrine-2.7.1/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php doctrine-2.7.2/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php --- doctrine-2.7.1/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php 2020-02-23 19:38:29.000000000 +0000 +++ doctrine-2.7.2/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php 2020-03-27 05:24:23.000000000 +0000 @@ -1095,11 +1095,25 @@ $this->loadFixturesCountries(); $this->_em->createQuery("SELECT PARTIAL c.{id} FROM Doctrine\Tests\Models\Cache\Country c") - ->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true) ->setCacheable(true) ->getResult(); } + /** + * @expectedException \Doctrine\ORM\Cache\CacheException + * @expectedExceptionMessage Second level cache does not support partial entities. + */ + public function testCacheableForcePartialLoadHintQueryException() + { + $this->evictRegions(); + $this->loadFixturesCountries(); + + $this->_em->createQuery('SELECT c FROM Doctrine\Tests\Models\Cache\Country c') + ->setCacheable(true) + ->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true) + ->getResult(); + } + /** * @expectedException \Doctrine\ORM\Cache\CacheException * @expectedExceptionMessage Second-level cache query supports only select statements. diff -Nru doctrine-2.7.1/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC7969Test.php doctrine-2.7.2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC7969Test.php --- doctrine-2.7.1/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC7969Test.php 1970-01-01 00:00:00.000000000 +0000 +++ doctrine-2.7.2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC7969Test.php 2020-03-27 05:24:23.000000000 +0000 @@ -0,0 +1,49 @@ +loadFixturesCountries(); + $this->loadFixturesStates(); + $this->loadFixturesCities(); + $this->loadFixturesAttractions(); + + // Entities are already cached due to fixtures - hence flush before testing + $region = $this->cache->getEntityCacheRegion(Attraction::class); + + if ($region instanceof DefaultMultiGetRegion) { + $region->getCache()->flushAll(); + } + + /** @var Bar $bar */ + $bar = $this->attractions[0]; + + $repository = $this->_em->getRepository(Bar::class); + + $this->assertFalse($this->cache->containsEntity(Bar::class, $bar->getId())); + $this->assertFalse($this->cache->containsEntity(Attraction::class, $bar->getId())); + + $repository->findOneBy([ + 'name' => $bar->getName(), + ]); + + $this->assertTrue($this->cache->containsEntity(Bar::class, $bar->getId())); + + $repository->findOneBy([ + 'name' => $bar->getName(), + ]); + + // One hit for entity cache, one hit for query cache + $this->assertEquals(2, $this->secondLevelCacheLogger->getHitCount()); + } +} diff -Nru doctrine-2.7.1/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php doctrine-2.7.2/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php --- doctrine-2.7.1/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php 1970-01-01 00:00:00.000000000 +0000 +++ doctrine-2.7.2/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php 2020-03-27 05:24:23.000000000 +0000 @@ -0,0 +1,163 @@ +setUpEntitySchema([ + GH8031Invoice::class, + ]); + } + + public function testEntityIsFetched() + { + $entity = new GH8031Invoice(new GH8031InvoiceCode(1, 2020, new GH8031Nested(10))); + $this->_em->persist($entity); + $this->_em->flush(); + $this->_em->clear(); + + /** @var GH8031Invoice $fetched */ + $fetched = $this->_em->find(GH8031Invoice::class, $entity->getId()); + $this->assertInstanceOf(GH8031Invoice::class, $fetched); + $this->assertSame(1, $fetched->getCode()->getNumber()); + $this->assertSame(2020, $fetched->getCode()->getYear()); + + $this->_em->clear(); + $this->assertCount( + 1, + $this->_em->getRepository(GH8031Invoice::class)->findBy([], ['code.number' => 'ASC']) + ); + } + + public function testEmbeddableWithAssociationNotAllowed() + { + $cm = $this->_em->getClassMetadata(GH8031EmbeddableWithAssociation::class); + + $this->assertArrayHasKey('invoice', $cm->associationMappings); + + $cm = $this->_em->getClassMetadata(GH8031Invoice::class); + + $this->assertCount(0, $cm->associationMappings); + } +} + +/** + * @Embeddable + */ +class GH8031EmbeddableWithAssociation +{ + /** @ManyToOne(targetEntity=GH8031Invoice::class) */ + public $invoice; +} + +/** + * @Embeddable + */ +class GH8031Nested +{ + /** + * @Column(type="integer", name="number", length=6) + * @var int + */ + protected $number; + + public function __construct(int $number) + { + $this->number = $number; + } + + public function getNumber() : int + { + return $this->number; + } +} + +/** + * @Embeddable + */ +class GH8031InvoiceCode extends GH8031AbstractYearSequenceValue +{ +} + +/** + * @Embeddable + */ +abstract class GH8031AbstractYearSequenceValue +{ + /** + * @Column(type="integer", name="number", length=6) + * @var int + */ + protected $number; + + /** + * @Column(type="smallint", name="year", length=4) + * @var int + */ + protected $year; + + /** @Embedded(class=GH8031Nested::class) */ + protected $nested; + + public function __construct(int $number, int $year, GH8031Nested $nested) + { + $this->number = $number; + $this->year = $year; + $this->nested = $nested; + } + + public function getNumber() : int + { + return $this->number; + } + + public function getYear() : int + { + return $this->year; + } +} + +/** + * @Entity + */ +class GH8031Invoice +{ + /** + * @Id + * @GeneratedValue + * @Column(type="integer") + */ + private $id; + + /** + * @Embedded(class=GH8031InvoiceCode::class) + * @var GH8031InvoiceCode + */ + private $code; + + /** @Embedded(class=GH8031EmbeddableWithAssociation::class) */ + private $embeddedAssoc; + + public function __construct(GH8031InvoiceCode $code) + { + $this->code = $code; + } + + public function getId() + { + return $this->id; + } + + public function getCode() : GH8031InvoiceCode + { + return $this->code; + } +} diff -Nru doctrine-2.7.1/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8055Test.php doctrine-2.7.2/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8055Test.php --- doctrine-2.7.1/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8055Test.php 1970-01-01 00:00:00.000000000 +0000 +++ doctrine-2.7.2/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8055Test.php 2020-03-27 05:24:23.000000000 +0000 @@ -0,0 +1,71 @@ +setUpEntitySchema([ + GH8055BaseClass::class, + GH8055SubClass::class, + ]); + } + + public function testNumericDescriminatorColumn() : void + { + $entity = new GH8055SubClass(); + $entity->value = 'test'; + $this->_em->persist($entity); + $this->_em->flush(); + $this->_em->clear(); + + $repository = $this->_em->getRepository(GH8055SubClass::class); + $hydrated = $repository->find($entity->id); + + self::assertSame('test', $hydrated->value); + } +} + +/** + * @Entity() + * @Table(name="gh8055") + * @InheritanceType("JOINED") + * @DiscriminatorColumn(name="discr", type="integer") + * @DiscriminatorMap({ + * "1" = GH8055BaseClass::class, + * "2" = GH8055SubClass::class + * }) + */ +class GH8055BaseClass +{ + /** + * @Id @GeneratedValue + * @Column(type="integer") + */ + public $id; +} + +/** + * @Entity() + */ +class GH8055SubClass extends GH8055BaseClass +{ + /** + * @Column(name="test", type="string") + * @var string + */ + public $value; +}