I guess that _validateAndCompleteMapping of AssociationMapping needs the addition of:
$this->joinTable = $mapping['joinTable']; at line 222 resulting in:
/**
if ( ! isset($mapping['sourceEntity']))
{
throw MappingException::missingSourceEntity($mapping['fieldName']);
}
$this->sourceEntityName = $mapping['sourceEntity'];
if ( ! isset($mapping['targetEntity']))
{
throw MappingException::missingTargetEntity($mapping['fieldName']);
}
$this->targetEntityName = $mapping['targetEntity'];
// Mandatory and optional attributes for either side
if ( ! isset($mapping['mappedBy'])) {
// Optional
if (isset($mapping['joinTable']) && $mapping['joinTable']) {
if ($mapping['joinTable']['name'][0] == '`')
{
$mapping['joinTable']['name'] = trim($mapping['joinTable']['name'], '`');
$mapping['joinTable']['quoted'] = true;
}
$this->joinTable = $mapping['joinTable'];
}
if (isset($mapping['inversedBy']))
{
$this->inversedBy = $mapping['inversedBy'];
}
} else
{
$this->isOwningSide = false;
$this->mappedBy = $mapping['mappedBy'];
$this->joinTable = $mapping['joinTable'];
}
// Optional attributes for both sides
$this->fetchMode = isset($mapping['fetch']) ? $mapping['fetch'] : self::FETCH_LAZY;
$cascades = isset($mapping['cascade']) ? $mapping['cascade'] : array();
if (in_array('all', $cascades))
{
$cascades = array(
'remove',
'persist',
'refresh',
'merge',
'detach'
);
}
$this->isCascadeRemove = in_array('remove', $cascades);
$this->isCascadePersist = in_array('persist', $cascades);
$this->isCascadeRefresh = in_array('refresh', $cascades);
$this->isCascadeMerge = in_array('merge', $cascades);
$this->isCascadeDetach = in_array('detach', $cascades);
}
Correct SQL should be: