mootensai\enhancedgii\BaseGenerator::isHasManyRelation PHP Method

isHasManyRelation() protected method

Determines if relation is of has many type
Since: 2.0.5
protected isHasManyRelation ( yii\db\TableSchema $table, array $fks ) : boolean
$table yii\db\TableSchema
$fks array
return boolean
    protected function isHasManyRelation($table, $fks)
    {
        $uniqueKeys = [$table->primaryKey];
        try {
            $uniqueKeys = array_merge($uniqueKeys, $this->getDbConnection()->getSchema()->findUniqueIndexes($table));
        } catch (NotSupportedException $e) {
            // ignore
        }
        foreach ($uniqueKeys as $uniqueKey) {
            if (count(array_diff(array_merge($uniqueKey, $fks), array_intersect($uniqueKey, $fks))) === 0) {
                return false;
            }
        }
        return true;
    }