forked from doctrine/orm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/2.17.x' into 3.0.x
- Loading branch information
Showing
17 changed files
with
130 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
lib/Doctrine/ORM/Query/AST/Phase2OptimizableConditional.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\ORM\Query\AST; | ||
|
||
/** | ||
* Marks types that can be used in place of a ConditionalExpression as a phase | ||
* 2 optimization. | ||
* | ||
* @internal | ||
* | ||
* @psalm-inheritors ConditionalPrimary|ConditionalFactor|ConditionalTerm | ||
*/ | ||
interface Phase2OptimizableConditional | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/Doctrine/Tests/ORM/Functional/Ticket/GH11017/GH11017Entity.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket\GH11017; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ORM\Entity] | ||
class GH11017Entity | ||
{ | ||
/** @var ?int */ | ||
#[ORM\Id] | ||
#[ORM\GeneratedValue] | ||
#[ORM\Column(type: 'integer')] | ||
public $id; | ||
|
||
/** @var GH11017Enum */ | ||
#[ORM\Column(type: 'string', enumType: GH11017Enum::class)] | ||
public $field; | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/Doctrine/Tests/ORM/Functional/Ticket/GH11017/GH11017Enum.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket\GH11017; | ||
|
||
enum GH11017Enum: string | ||
{ | ||
case FIRST = 'first'; | ||
case SECOND = 'second'; | ||
} |
46 changes: 46 additions & 0 deletions
46
tests/Doctrine/Tests/ORM/Functional/Ticket/GH11017/GH11017Test.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket\GH11017; | ||
|
||
use Doctrine\ORM\AbstractQuery; | ||
use Doctrine\ORM\Query\ResultSetMappingBuilder; | ||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
|
||
use function sprintf; | ||
|
||
class GH11017Test extends OrmFunctionalTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->setUpEntitySchema([ | ||
GH11017Entity::class, | ||
]); | ||
} | ||
|
||
public function testPostPersistListenerUpdatingObjectFieldWhileOtherInsertPending(): void | ||
{ | ||
$entity1 = new GH11017Entity(); | ||
$entity1->field = GH11017Enum::FIRST; | ||
$this->_em->persist($entity1); | ||
|
||
$this->_em->flush(); | ||
$this->_em->clear(); | ||
|
||
$rsm = new ResultSetMappingBuilder($this->_em, ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT); | ||
$rsm->addRootEntityFromClassMetadata(GH11017Entity::class, 'e'); | ||
|
||
$tableName = $this->_em->getClassMetadata(GH11017Entity::class)->getTableName(); | ||
$sql = sprintf('SELECT %s FROM %s e WHERE id = :id', $rsm->generateSelectClause(), $tableName); | ||
|
||
$query = $this->_em->createNativeQuery($sql, $rsm) | ||
->setParameter('id', $entity1->id); | ||
|
||
$entity1Reloaded = $query->getSingleResult(AbstractQuery::HYDRATE_ARRAY); | ||
self::assertNotNull($entity1Reloaded); | ||
self::assertSame($entity1->field, $entity1Reloaded['field']); | ||
} | ||
} |