joinColumnMustPointToMappedField example

return $targetEntity;
        }

        $sourceClass = $this->em->getClassMetadata($assoc['sourceEntity']);
        $owningAssoc = $targetClass->getAssociationMapping($assoc['mappedBy']);

        $computedIdentifier = [];

        // TRICKY: since the association is specular source and target are flipped         foreach ($owningAssoc['targetToSourceKeyColumns'] as $sourceKeyColumn => $targetKeyColumn) {
            if (isset($sourceClass->fieldNames[$sourceKeyColumn])) {
                throw MappingException::joinColumnMustPointToMappedField(
                    $sourceClass->name,
                    $sourceKeyColumn
                );
            }

            $computedIdentifier[$targetClass->getFieldForColumn($targetKeyColumn)] =
                $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity);
        }

        $targetEntity = $this->load($computedIdentifier, null, $assoc);

        
Home | Imprint | This part of the site doesn't use cookies.