protected _generateJunctionAssociations ( |
||
$junction | The junction table. | |
$source | The source table. | |
$target | The target table. | |
return | void |
protected function _generateJunctionAssociations($junction, $source, $target)
{
$tAlias = $target->alias();
$sAlias = $source->alias();
if (!$junction->association($tAlias)) {
$junction->belongsTo($tAlias, ['foreignKey' => $this->targetForeignKey(), 'targetTable' => $target]);
}
if (!$junction->association($sAlias)) {
$junction->belongsTo($sAlias, ['foreignKey' => $this->foreignKey(), 'targetTable' => $source]);
}
}