fix DDC-142 load OneToOne EAGER
This commit is contained in:
parent
cd806b83db
commit
e0a236a9af
@ -1048,7 +1048,10 @@ class BasicEntityPersister
|
||||
$this->_selectJoinSql .= ' ' . $this->quoteStrategy->getTableName($eagerEntity) . ' ' . $this->_getSQLTableAlias($eagerEntity->name, $assocAlias) .' ON ';
|
||||
|
||||
$tableAlias = $this->_getSQLTableAlias($assoc['targetEntity'], $assocAlias);
|
||||
foreach ($assoc['sourceToTargetKeyColumns'] as $sourceCol => $targetCol) {
|
||||
foreach ($assoc['joinColumns'] as $joinColumn) {
|
||||
$sourceCol = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->_class);
|
||||
$targetCol = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->_class);
|
||||
|
||||
if ( ! $first) {
|
||||
$this->_selectJoinSql .= ' AND ';
|
||||
}
|
||||
|
@ -18,8 +18,6 @@ class DDC142Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(array(
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\Quote\User'),
|
||||
@ -28,9 +26,7 @@ class DDC142Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\Quote\Address'),
|
||||
));
|
||||
} catch(\Exception $e) {
|
||||
//$this->fail($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testCreateRetreaveUpdateDelete()
|
||||
@ -53,11 +49,41 @@ class DDC142Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertNotNull($user->id);
|
||||
$this->markTestIncomplete();
|
||||
$id = $user->id;
|
||||
$this->assertNotNull($id);
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\Quote\User', $user->id);
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\Quote\User', $id);
|
||||
$address = $user->getAddress();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Quote\User', $user);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Quote\Address', $user->getAddress());
|
||||
|
||||
$this->assertEquals('FabioBatSilva', $user->name);
|
||||
$this->assertEquals('12345', $address->zip);
|
||||
|
||||
|
||||
$user->name = 'FabioBatSilva1';
|
||||
$user->address = null;
|
||||
|
||||
$this->_em->persist($user);
|
||||
$this->_em->remove($address);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\Quote\User', $id);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Quote\User', $user);
|
||||
$this->assertNull($user->getAddress());
|
||||
|
||||
$this->assertEquals('FabioBatSilva1', $user->name);
|
||||
|
||||
|
||||
$this->_em->remove($user);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertNull($this->_em->find('Doctrine\Tests\Models\Quote\User', $id));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user