src/Repository.php
public function distinct($fieldName, $filters = [], $options = [])
    {
        $field = $fieldName;

        $propInfos = $this->classMetadata->getPropertyInfoForField($fieldName);
        if (!$propInfos) {
            $propInfos = $this->classMetadata->getPropertyInfo($fieldName);
        }

        if (isset($propInfos)) {
            $field = $propInfos->getField();

            if ($propInfos->getMetadata()) {
                $field = "metadata." . $field;
            }
        }

        $filters = $this->castQuery($filters);

        $result = $this->collection->distinct($field, $filters, $options);
        return $result;
    }
public function distinct($fieldName, $filters = [], $options = [])
    {
        $field = $fieldName;

        $propInfos = $this->classMetadata->getPropertyInfoForField($fieldName);
        if (!$propInfos) {
            $propInfos = $this->classMetadata->getPropertyInfo($fieldName);
        }

        if (isset($propInfos)) {
            $field = $propInfos->getField();

            if ($propInfos->getMetadata()) {
                $field = "metadata." . $field;
            }
        }

        $filters = $this->castQuery($filters);

        $result = $this->collection->distinct($field, $filters, $options);
        return $result;
    }
public function distinct ( $ fieldName , $ filters = [ ] , $ options = [ ] ) { $ field = $ fieldName ; $ propInfos = $ this -> classMetadata -> getPropertyInfoForField ( $ fieldName ) ; if ( ! $ propInfos ) { $ propInfos = $ this -> classMetadata -> getPropertyInfo ( $ fieldName ) ; } if ( isset ( $ propInfos ) ) { $ field = $ propInfos -> getField ( ) ; if ( $ propInfos -> getMetadata ( ) ) { $ field = "metadata." . $ field ; } } $ filters = $ this -> castQuery ( $ filters ) ; $ result = $ this -> collection -> distinct ( $ field , $ filters , $ options ) ; return $ result ; }
Get distinct value for a field

@param  string $fieldName Name of the field
@param  array  $filters   Filters of query
@param  array  $options   Options of query
@return array             List of distinct values
Get distinct value for a field