forked from doctrine/orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 2.11.x: Bump PHPStan & Psalm (doctrine#9303) Removing list "Lifecycle Events" (doctrine#9243) Drop unneeded backslashes Fix Hidden fields triggering error when using getSingleScalarResult() (doctrine#8340) Findby joined lookup (doctrine#8285)
- Loading branch information
Showing
9 changed files
with
353 additions
and
204 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket; | ||
|
||
use Doctrine\Common\Collections\Collection; | ||
use Doctrine\ORM\Mapping\Column; | ||
use Doctrine\ORM\Mapping\DiscriminatorMap; | ||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\GeneratedValue; | ||
use Doctrine\ORM\Mapping\Id; | ||
use Doctrine\ORM\Mapping\InheritanceType; | ||
use Doctrine\ORM\Mapping\ManyToOne; | ||
use Doctrine\ORM\Mapping\OneToMany; | ||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
|
||
class GH7512Test extends OrmFunctionalTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->setUpEntitySchema([ | ||
GH7512EntityA::class, | ||
GH7512EntityB::class, | ||
GH7512EntityC::class, | ||
]); | ||
|
||
$this->_em->persist(new GH7512EntityA()); | ||
$this->_em->persist(new GH7512EntityC()); | ||
$this->_em->flush(); | ||
$this->_em->clear(); | ||
} | ||
|
||
public function testFindEntityByAssociationPropertyJoinedChildWithClearMetadata(): void | ||
{ | ||
// unset metadata for entity B as though it hasn't been touched yet in application lifecycle. | ||
$this->_em->getMetadataFactory()->setMetadataFor(GH7512EntityB::class, null); | ||
$result = $this->_em->getRepository(GH7512EntityC::class)->findBy([ | ||
'entityA' => new GH7512EntityB(), | ||
]); | ||
$this->assertEmpty($result); | ||
} | ||
} | ||
|
||
/** | ||
* @Entity() | ||
* @InheritanceType("JOINED") | ||
* @DiscriminatorMap({ | ||
* "entitya"=Doctrine\Tests\ORM\Functional\Ticket\GH7512EntityA::class, | ||
* "entityB"=Doctrine\Tests\ORM\Functional\Ticket\GH7512EntityB::class | ||
* }) | ||
*/ | ||
class GH7512EntityA | ||
{ | ||
/** | ||
* @Column(type="integer") | ||
* @Id() | ||
* @GeneratedValue(strategy="AUTO") | ||
* @var int | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @OneToMany(targetEntity="Doctrine\Tests\ORM\Functional\Ticket\GH7512EntityC", mappedBy="entityA") | ||
* @var Collection<int, GH7512EntityC> | ||
*/ | ||
public $entityCs; | ||
} | ||
|
||
/** | ||
* @Entity() | ||
*/ | ||
class GH7512EntityB extends GH7512EntityA | ||
{ | ||
} | ||
|
||
/** | ||
* @Entity() | ||
*/ | ||
class GH7512EntityC | ||
{ | ||
/** | ||
* @Column(type="integer") | ||
* @Id() | ||
* @GeneratedValue(strategy="AUTO") | ||
* @var int | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @ManyToOne(targetEntity="Doctrine\Tests\ORM\Functional\Ticket\GH7512EntityA", inversedBy="entityCs") | ||
* @var GH7512EntityA | ||
*/ | ||
public $entityA; | ||
} |
Oops, something went wrong.