src/Model/AssociationsAwareTrait.php
private function setByTypeRelationField(string $module, CsvField $field, CsvField $moduleField) : void
    {
        if (! $this->isRelatedType($field)) {
            return;
        }

        // skip for field with type "related(Articles)" when current module is "Articles"
        if ($this->getTableName() === $field->getAssocCsvModule()) {
            return;
        }

        // skip for fields associated with Footprint behavior ('related' type fields associated with Users table)
        if ($this->isFootprintField($field) || $this->isFootprintField($moduleField)) {
            return;
        }

        $this->setAssociation(
            'belongsToMany',
            static::generateAssociationName($module, $field->getName()),
            [
                'joinTable' => Inflector::tableize($module),
                'className' => $field->getAssocCsvModule(),
                'foreignKey' => $moduleField->getName(),
                'targetForeignKey' => $field->getName()
            ]
        );
    }
private function setByTypeRelationField(string $module, CsvField $field, CsvField $moduleField) : void
    {
        if (! $this->isRelatedType($field)) {
            return;
        }

        // skip for field with type "related(Articles)" when current module is "Articles"
        if ($this->getTableName() === $field->getAssocCsvModule()) {
            return;
        }

        // skip for fields associated with Footprint behavior ('related' type fields associated with Users table)
        if ($this->isFootprintField($field) || $this->isFootprintField($moduleField)) {
            return;
        }

        $this->setAssociation(
            'belongsToMany',
            static::generateAssociationName($module, $field->getName()),
            [
                'joinTable' => Inflector::tableize($module),
                'className' => $field->getAssocCsvModule(),
                'foreignKey' => $moduleField->getName(),
                'targetForeignKey' => $field->getName()
            ]
        );
    }
private function setByTypeRelationField ( string $ module , CsvField $ field , CsvField $ moduleField ) : void { if ( ! $ this -> isRelatedType ( $ field ) ) { return ; } // skip for field with type "related(Articles)" when current module is "Articles" if ( $ this -> getTableName ( ) === $ field -> getAssocCsvModule ( ) ) { return ; } // skip for fields associated with Footprint behavior ('related' type fields associated with Users table) if ( $ this -> isFootprintField ( $ field ) || $ this -> isFootprintField ( $ moduleField ) ) { return ; } $ this -> setAssociation ( 'belongsToMany' , static :: generateAssociationName ( $ module , $ field -> getName ( ) ) , [ 'joinTable' => Inflector :: tableize ( $ module ) , 'className' => $ field -> getAssocCsvModule ( ) , 'foreignKey' => $ moduleField -> getName ( ) , 'targetForeignKey' => $ field -> getName ( ) ] ) ; }
Set associations by field, for "relation" type Modules.

@param string $module Module name
@param \CsvMigrations\FieldHandlers\CsvField $field CSV Field instance
@param \CsvMigrations\FieldHandlers\CsvField $moduleField Module related CSV Field instance
@return void
Set associations by field for relation type Modules .