private function hasUniqueConstraint(ClassMetadata $metadata, array $columns)
    {
        if (!isset($metadata->table['uniqueConstraints'])) {
            return false;
        }

        foreach ($metadata->table['uniqueConstraints'] as $constraint) {
            if (!array_diff($constraint['columns'], $columns)) {
                return true;
            }
        }

        return false;
    }
private function hasUniqueConstraint(ClassMetadata $metadata, array $columns)
    {
        if (!isset($metadata->table['uniqueConstraints'])) {
            return false;
        }

        foreach ($metadata->table['uniqueConstraints'] as $constraint) {
            if (!array_diff($constraint['columns'], $columns)) {
                return true;
            }
        }

        return false;
    }
private function hasUniqueConstraint ( ClassMetadata $ metadata , array $ columns ) { if ( ! isset ( $ metadata -> table [ 'uniqueConstraints' ] ) ) { return false ; } foreach ( $ metadata -> table [ 'uniqueConstraints' ] as $ constraint ) { if ( ! array_diff ( $ constraint [ 'columns' ] , $ columns ) ) { return true ; } } return false ; }
Check if an unique constraint has been defined.

@param ClassMetadata $metadata
@param array         $columns

@return bool
Check if an unique constraint has been defined .