-
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.
#7841 SchemaTool generates extra diff for platforms without FK support
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 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
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\Common\Collections\ArrayCollection; | ||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
|
||
class GH7841Test extends OrmFunctionalTestCase | ||
{ | ||
public function testForeignKeysNotCompare() : void | ||
{ | ||
if ($this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { | ||
$this->markTestSkipped('Test for platforms without foreign keys support'); | ||
} | ||
$class = $this->_em->getClassMetadata(GH7841Child::class); | ||
$this->_schemaTool->updateSchema([$class], true); | ||
$diff = $this->_schemaTool->getUpdateSchemaSql([$class], true); | ||
|
||
self::assertEmpty($diff); | ||
|
||
$this->_schemaTool->dropSchema([$class]); | ||
} | ||
} | ||
|
||
/** | ||
* @Entity | ||
*/ | ||
class GH7841Parent | ||
{ | ||
/** @Id @Column(type="integer") @GeneratedValue */ | ||
public $id; | ||
|
||
/** @OneToMany(targetEntity=GH7841Child::class, mappedBy="parent") */ | ||
public $children; | ||
|
||
public function __construct() | ||
{ | ||
$this->children = new ArrayCollection(); | ||
} | ||
} | ||
|
||
/** | ||
* @Entity | ||
*/ | ||
class GH7841Child | ||
{ | ||
/** @Id @Column(type="integer") @GeneratedValue */ | ||
public $id; | ||
|
||
/** @ManyToOne(targetEntity=GH7841Parent::class) */ | ||
public $parent; | ||
} |