protected function _generateJunctionAssociations($junction, $source, $target)
    {
        $tAlias = $target->getAlias();
        $sAlias = $source->getAlias();

        if (!$junction->hasAssociation($tAlias)) {
            $junction->belongsTo($tAlias, [
                'foreignKey' => $this->getTargetForeignKey(),
                'targetTable' => $target
            ]);
        }
        if (!$junction->hasAssociation($sAlias)) {
            $junction->belongsTo($sAlias, [
                'foreignKey' => $this->getForeignKey(),
                'targetTable' => $source
            ]);
        }
    }
protected function _generateJunctionAssociations($junction, $source, $target)
    {
        $tAlias = $target->getAlias();
        $sAlias = $source->getAlias();

        if (!$junction->hasAssociation($tAlias)) {
            $junction->belongsTo($tAlias, [
                'foreignKey' => $this->getTargetForeignKey(),
                'targetTable' => $target
            ]);
        }
        if (!$junction->hasAssociation($sAlias)) {
            $junction->belongsTo($sAlias, [
                'foreignKey' => $this->getForeignKey(),
                'targetTable' => $source
            ]);
        }
    }
protected function _generateJunctionAssociations ( $ junction , $ source , $ target ) { $ tAlias = $ target -> getAlias ( ) ; $ sAlias = $ source -> getAlias ( ) ; if ( ! $ junction -> hasAssociation ( $ tAlias ) ) { $ junction -> belongsTo ( $ tAlias , [ 'foreignKey' => $ this -> getTargetForeignKey ( ) , 'targetTable' => $ target ] ) ; } if ( ! $ junction -> hasAssociation ( $ sAlias ) ) { $ junction -> belongsTo ( $ sAlias , [ 'foreignKey' => $ this -> getForeignKey ( ) , 'targetTable' => $ source ] ) ; } }
Generate associations on the junction table as necessary

Generates the following associations:

- junction belongsTo source e.g. ArticlesTags belongsTo Tags
- junction belongsTo target e.g. ArticlesTags belongsTo Articles

You can override these generated associations by defining associations
with the correct aliases.

@param \Cake\ORM\Table $junction The junction table.
@param \Cake\ORM\Table $source The source table.
@param \Cake\ORM\Table $target The target table.
@return void
Generate associations on the junction table as necessary