Cake\ORM\Association\BelongsToMany::_generateSourceAssociations PHP Method

_generateSourceAssociations() protected method

Generates the following associations: - source hasMany junction e.g. Tags hasMany ArticlesTags You can override these generated associations by defining associations with the correct aliases.
protected _generateSourceAssociations ( Table $junction, Table $source ) : void
$junction Cake\ORM\Table The junction table.
$source Cake\ORM\Table The source table.
return void
    protected function _generateSourceAssociations($junction, $source)
    {
        $junctionAlias = $junction->alias();
        if (!$source->association($junctionAlias)) {
            $source->hasMany($junctionAlias, ['targetTable' => $junction, 'foreignKey' => $this->foreignKey(), 'strategy' => $this->_strategy]);
        }
    }