Revert "Merge branch 'fix/#6499-#6533-fix-commit-order-calculation-consider-all-join-column-fields'"
This reverts commit 2a58645cb5870f0ab61e918c7165c248d225dbac, reversing changes made to 6d428c90e24c914c1e5d817d74646f3b94757c43.
This commit is contained in:
parent
2a58645cb5
commit
a0c0d3bf2a
@ -1154,11 +1154,7 @@ class UnitOfWork implements PropertyChangedListener
|
||||
|
||||
$joinColumns = reset($assoc['joinColumns']);
|
||||
|
||||
$calc->addDependency(
|
||||
$targetClass->name,
|
||||
$class->name,
|
||||
(int) (($joinColumns['nullable'] ?? true) === false)
|
||||
);
|
||||
$calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
|
||||
|
||||
// If the target class has mapped subclasses, these share the same dependency.
|
||||
if ( ! $targetClass->subClasses) {
|
||||
|
@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Functional\Ticket;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
* @group #6499
|
||||
*
|
||||
*
|
||||
* Specifically, DDC6499B has a dependency on DDC6499A, and DDC6499A
|
||||
* has a dependency on DDC6499B. Since DDC6499A#b is not nullable,
|
||||
* the DDC6499B should be inserted first.
|
||||
*/
|
||||
class DDC6499Test extends OrmFunctionalTestCase
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->_schemaTool->createSchema([
|
||||
$this->_em->getClassMetadata(DDC6499A::class),
|
||||
$this->_em->getClassMetadata(DDC6499B::class),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function tearDown() : void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
$this->_schemaTool->dropSchema([
|
||||
$this->_em->getClassMetadata(DDC6499A::class),
|
||||
$this->_em->getClassMetadata(DDC6499B::class),
|
||||
]);
|
||||
}
|
||||
|
||||
public function testIssue() : void
|
||||
{
|
||||
$b = new DDC6499B();
|
||||
$a = new DDC6499A();
|
||||
|
||||
$this->_em->persist($a);
|
||||
|
||||
$a->b = $b;
|
||||
|
||||
$this->_em->persist($b);
|
||||
|
||||
$this->_em->flush();
|
||||
|
||||
self::assertInternalType('integer', $a->id);
|
||||
self::assertInternalType('integer', $b->id);
|
||||
}
|
||||
|
||||
public function testIssueReversed() : void
|
||||
{
|
||||
$b = new DDC6499B();
|
||||
$a = new DDC6499A();
|
||||
|
||||
$a->b = $b;
|
||||
|
||||
$this->_em->persist($b);
|
||||
$this->_em->persist($a);
|
||||
|
||||
$this->_em->flush();
|
||||
|
||||
self::assertInternalType('integer', $a->id);
|
||||
self::assertInternalType('integer', $b->id);
|
||||
}
|
||||
}
|
||||
|
||||
/** @Entity */
|
||||
class DDC6499A
|
||||
{
|
||||
/** @Id @Column(type="integer") @GeneratedValue */
|
||||
public $id;
|
||||
|
||||
/** @JoinColumn(nullable=false) @OneToOne(targetEntity=DDC6499B::class) */
|
||||
public $b;
|
||||
}
|
||||
|
||||
/** @Entity */
|
||||
class DDC6499B
|
||||
{
|
||||
/** @Id @Column(type="integer") @GeneratedValue */
|
||||
public $id;
|
||||
|
||||
/** @ManyToOne(targetEntity="DDC6499A") */
|
||||
private $a;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user