Commit 9200e17b authored by romanb's avatar romanb

[2.0][DDC-51] Fixed.

parent 5842411a
......@@ -106,13 +106,13 @@ class OneToManyMapping extends AssociationMapping
}
/**
* Loads a one-to-many collection.
*
*
* @param $sourceEntity
* @param $targetCollection
* @param $em
* @param $sourceEntity The entity that owns the collection.
* @param $targetCollection The collection to load/fill.
* @param $em The EntityManager to use.
* @param $joinColumnValues
* @return unknown_type
* @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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment