src/Model/AssociationsAwareTrait.php
private function setByTypeSelfRelationField(string $module, array $fields) : void
    {
        $first = $fields[0];
        $second = $fields[1];

        $this->setAssociation(
            'belongsToMany',
            static::generateAssociationName($module, $first->getName()),
            [
                'joinTable' => Inflector::tableize($module),
                'className' => $first->getAssocCsvModule(),
                'foreignKey' => $second->getName(),
                'targetForeignKey' => $first->getName()
            ]
        );

        $this->setAssociation(
            'belongsToMany',
            static::generateAssociationName($module, $second->getName()),
            [
                'joinTable' => Inflector::tableize($module),
                'className' => $second->getAssocCsvModule(),
                'foreignKey' => $first->getName(),
                'targetForeignKey' => $second->getName()
            ]
        );
    }
private function setByTypeSelfRelationField(string $module, array $fields) : void
    {
        $first = $fields[0];
        $second = $fields[1];

        $this->setAssociation(
            'belongsToMany',
            static::generateAssociationName($module, $first->getName()),
            [
                'joinTable' => Inflector::tableize($module),
                'className' => $first->getAssocCsvModule(),
                'foreignKey' => $second->getName(),
                'targetForeignKey' => $first->getName()
            ]
        );

        $this->setAssociation(
            'belongsToMany',
            static::generateAssociationName($module, $second->getName()),
            [
                'joinTable' => Inflector::tableize($module),
                'className' => $second->getAssocCsvModule(),
                'foreignKey' => $first->getName(),
                'targetForeignKey' => $second->getName()
            ]
        );
    }
private function setByTypeSelfRelationField ( string $ module , array $ fields ) : void { $ first = $ fields [ 0 ] ; $ second = $ fields [ 1 ] ; $ this -> setAssociation ( 'belongsToMany' , static :: generateAssociationName ( $ module , $ first -> getName ( ) ) , [ 'joinTable' => Inflector :: tableize ( $ module ) , 'className' => $ first -> getAssocCsvModule ( ) , 'foreignKey' => $ second -> getName ( ) , 'targetForeignKey' => $ first -> getName ( ) ] ) ; $ this -> setAssociation ( 'belongsToMany' , static :: generateAssociationName ( $ module , $ second -> getName ( ) ) , [ 'joinTable' => Inflector :: tableize ( $ module ) , 'className' => $ second -> getAssocCsvModule ( ) , 'foreignKey' => $ first -> getName ( ) , 'targetForeignKey' => $ second -> getName ( ) ] ) ; }
Set associations for "self relation" type Modules.

@param string $module Module name
@param mixed[] $fields CSV Fields
@return void
Set associations for self relation type Modules .