[2.0][DDC-51] Fixed.
This commit is contained in:
parent
5842411afe
commit
9200e17bc1
@ -106,13 +106,13 @@ class OneToManyMapping extends AssociationMapping
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a one-to-many collection.
|
||||
*
|
||||
*
|
||||
* @param $sourceEntity
|
||||
* @param $targetCollection
|
||||
* @param $em
|
||||
* @param $joinColumnValues
|
||||
* @return unknown_type
|
||||
* @param $sourceEntity The entity that owns the collection.
|
||||
* @param $targetCollection The collection to load/fill.
|
||||
* @param $em The EntityManager to use.
|
||||
* @param $joinColumnValues
|
||||
* @return void
|
||||
*/
|
||||
public function load($sourceEntity, $targetCollection, $em, array $joinColumnValues = array())
|
||||
{
|
||||
@ -121,9 +121,9 @@ class OneToManyMapping extends AssociationMapping
|
||||
$sourceClass = $em->getClassMetadata($this->sourceEntityName);
|
||||
$owningAssoc = $em->getClassMetadata($this->targetEntityName)->associationMappings[$this->mappedByFieldName];
|
||||
// TRICKY: since the association is specular source and target are flipped
|
||||
foreach ($owningAssoc->getTargetToSourceKeyColumns() as $sourceKeyColumn => $targetKeyColumn) {
|
||||
foreach ($owningAssoc->targetToSourceKeyColumns as $sourceKeyColumn => $targetKeyColumn) {
|
||||
// getting id
|
||||
if (isset($sourceClass->reflFields[$sourceKeyColumn])) {
|
||||
if (isset($sourceClass->fieldNames[$sourceKeyColumn])) {
|
||||
$conditions[$targetKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity);
|
||||
} else {
|
||||
$conditions[$targetKeyColumn] = $joinColumnValues[$sourceKeyColumn];
|
||||
|
@ -201,7 +201,7 @@ class OneToOneMapping extends AssociationMapping
|
||||
if ($this->isOwningSide) {
|
||||
foreach ($this->sourceToTargetKeyColumns as $sourceKeyColumn => $targetKeyColumn) {
|
||||
// getting customer_id
|
||||
if (isset($sourceClass->reflFields[$sourceKeyColumn])) {
|
||||
if (isset($sourceClass->fieldNames[$sourceKeyColumn])) {
|
||||
$conditions[$targetKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity);
|
||||
} else {
|
||||
$conditions[$targetKeyColumn] = $joinColumnValues[$sourceKeyColumn];
|
||||
@ -220,7 +220,7 @@ class OneToOneMapping extends AssociationMapping
|
||||
// TRICKY: since the association is specular source and target are flipped
|
||||
foreach ($owningAssoc->targetToSourceKeyColumns as $sourceKeyColumn => $targetKeyColumn) {
|
||||
// getting id
|
||||
if (isset($sourceClass->reflFields[$sourceKeyColumn])) {
|
||||
if (isset($sourceClass->fieldNames[$sourceKeyColumn])) {
|
||||
$conditions[$targetKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity);
|
||||
} else {
|
||||
$conditions[$targetKeyColumn] = $joinColumnValues[$sourceKeyColumn];
|
||||
|
@ -87,7 +87,6 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona
|
||||
public function testLazyLoadsObjectsOnTheOwningSide()
|
||||
{
|
||||
$this->_createFixture();
|
||||
$this->_em->getConfiguration()->setAllowPartialObjects(false);
|
||||
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceProduct');
|
||||
$metadata->getAssociationMapping('features')->fetchMode = AssociationMapping::FETCH_LAZY;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user