private function hasUniqueConstraint(ClassMetadata $mapping, array $columns)
    {
        if (!array_diff($mapping->getIdentifierColumnNames(), $columns)) {
            return true;
        }

        if (!isset($mapping->table['uniqueConstraints'])) {
            return false;
        }

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

        return false;
    }
private function hasUniqueConstraint(ClassMetadata $mapping, array $columns)
    {
        if (!array_diff($mapping->getIdentifierColumnNames(), $columns)) {
            return true;
        }

        if (!isset($mapping->table['uniqueConstraints'])) {
            return false;
        }

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

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

@param ClassMetadata $mapping
@param array $columns
@return bool
Check if an unique constraint has been defined