for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\DBAL\Schema\Table;
use Doctrine\Tests\ORM\Functional\DatabaseDriverTestCase;
/**
* Verifies that associations/columns with an inline '_id' get named properly
*
* Github issue: 7684
*/
class GH7684 extends DatabaseDriverTestCase
{
public function testIssue() : void
if (! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Platform does not support foreign keys.');
}
$card = new Table('GH7684_identity_test');
$card->addColumn('id', 'integer');
$card->setPrimaryKey(['id']);
$translation = new Table('GH7684_identity_test_assoc');
$translation->addColumn('id', 'integer');
$translation->addColumn('gh7684_identity_test_id', 'integer');
$translation->setPrimaryKey(['id']);
$translation->addForeignKeyConstraint('GH7684_identity_test', ['gh7684_identity_test_id'], ['id']);
$metadatas = $this->convertToClassMetadata([$card, $translation]);
$this->assertNotNull($metadatas['Gh7684IdentityTest'] ?? null);
$this->assertNotNull($metadatas['Gh7684IdentityTestAssoc'] ?? null);
$metadata = $metadatas['Gh7684IdentityTestAssoc'];
$metadata->getAssociationMapping('gh7684IdentityTest');