-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix QueryBuilder::getParameter() on parameter names with colons (#8107)
* Fix type errors (partially cherry picked from commit 17e7c2a) * Fix QueryBuilder::getParameter() on parameter names with colons Fixes #8106. Co-authored-by: Michael Moravec <mail@majkl578.cz>
- Loading branch information
Showing
4 changed files
with
73 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket; | ||
|
||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
|
||
/** | ||
* @group GH-8106 | ||
*/ | ||
class GH8106Test extends OrmFunctionalTestCase | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function setUp() : void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->_schemaTool->createSchema( | ||
[ | ||
$this->_em->getClassMetadata(GH8106User::class), | ||
] | ||
); | ||
} | ||
|
||
public function testIssue() : void | ||
{ | ||
$user = new GH8106User(); | ||
$this->_em->persist($user); | ||
$this->_em->flush(); | ||
$this->_em->clear(); | ||
|
||
$qb = $this->_em->createQueryBuilder(); | ||
$qb | ||
->select('u') | ||
->from(GH8106User::class, 'u') | ||
->where('u.id = :id') | ||
->setParameter(':id', 1) | ||
->setParameter(':id', 1); | ||
|
||
$result = $qb->getQuery()->getResult(); // should not throw QueryException | ||
|
||
self::assertCount(1, $result); | ||
} | ||
} | ||
|
||
/** @Entity */ | ||
class GH8106User | ||
{ | ||
/** @Id @Column(type="integer") @GeneratedValue */ | ||
public $id; | ||
} |