-
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.
* 2.19.x: Fix OneToManyPersister::deleteEntityCollection missing discriminator column/value. (GH-11500) Skip joined entity creation for empty relation (#10889) ci: maintained and stable mariadb version (11.4 current lts) (#11490) fix(docs): use string value in `addAttribute` Replace assertion with exception (#11489) Use ramsey/composer-install in PHPBench workflow update EntityManager#transactional to EntityManager#wrapInTransaction Fix cloning entities Consider usage of setFetchMode when checking for simultaneous usage of fetch-mode EAGER and WITH condition.
- Loading branch information
Showing
16 changed files
with
351 additions
and
29 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
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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\Models\ECommerce; | ||
|
||
use Doctrine\ORM\Mapping\Column; | ||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\GeneratedValue; | ||
use Doctrine\ORM\Mapping\Id; | ||
use Doctrine\ORM\Mapping\Index; | ||
use Doctrine\ORM\Mapping\Table; | ||
|
||
/** | ||
* ECommerceProduct2 | ||
* Resets the id when being cloned. | ||
*/ | ||
#[Entity] | ||
#[Table(name: 'ecommerce_products')] | ||
#[Index(name: 'name_idx', columns: ['name'])] | ||
class ECommerceProduct2 | ||
{ | ||
#[Column] | ||
#[Id] | ||
#[GeneratedValue] | ||
private int|null $id = null; | ||
|
||
#[Column(length: 50, nullable: true)] | ||
private string|null $name = null; | ||
|
||
public function getId(): int|null | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getName(): string|null | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function __clone() | ||
{ | ||
$this->id = null; | ||
$this->name = 'Clone of ' . $this->name; | ||
} | ||
} |
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,79 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
use PHPUnit\Framework\Attributes\Group; | ||
|
||
/** @see https://github.com/doctrine/orm/issues/10889 */ | ||
#[Group('GH10889')] | ||
class GH10889Test extends OrmFunctionalTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->createSchemaForModels( | ||
GH10889Person::class, | ||
GH10889Company::class, | ||
GH10889Resume::class, | ||
); | ||
} | ||
|
||
public function testIssue(): void | ||
{ | ||
$person = new GH10889Person(); | ||
$resume = new GH10889Resume($person, null); | ||
|
||
$this->_em->persist($person); | ||
$this->_em->persist($resume); | ||
$this->_em->flush(); | ||
$this->_em->clear(); | ||
|
||
/** @var list<GH10889Resume> $resumes */ | ||
$resumes = $this->_em | ||
->getRepository(GH10889Resume::class) | ||
->createQueryBuilder('resume') | ||
->leftJoin('resume.currentCompany', 'company')->addSelect('company') | ||
->getQuery() | ||
->getResult(); | ||
|
||
$this->assertArrayHasKey(0, $resumes); | ||
$this->assertEquals(1, $resumes[0]->person->id); | ||
$this->assertNull($resumes[0]->currentCompany); | ||
} | ||
} | ||
|
||
#[ORM\Entity] | ||
class GH10889Person | ||
{ | ||
#[ORM\Id] | ||
#[ORM\Column] | ||
#[ORM\GeneratedValue] | ||
public int|null $id = null; | ||
} | ||
|
||
#[ORM\Entity] | ||
class GH10889Company | ||
{ | ||
#[ORM\Id] | ||
#[ORM\Column] | ||
#[ORM\GeneratedValue] | ||
public int|null $id = null; | ||
} | ||
|
||
#[ORM\Entity] | ||
class GH10889Resume | ||
{ | ||
public function __construct( | ||
#[ORM\Id] | ||
#[ORM\OneToOne] | ||
public GH10889Person $person, | ||
#[ORM\ManyToOne] | ||
public GH10889Company|null $currentCompany, | ||
) { | ||
} | ||
} |
Oops, something went wrong.