src/Sulu/Component/Rest/Listing/ListRepository.php
public function getFieldsWitTypes(array $types, $intersectArray = null)
    {
        $result = [];
        foreach ($this->getClassMetadata()->getFieldNames() as $field) {
            $type = $this->getClassMetadata()->getTypeOfField($field);
            if (in_array($type, $types)) {
                $result[] = $field;
            }
        }
        // calculate intersection
        if (!is_null($intersectArray)) {
            $result = array_intersect($result, $intersectArray);
        }

        return $result;
    }
public function getFieldsWitTypes(array $types, $intersectArray = null)
    {
        $result = [];
        foreach ($this->getClassMetadata()->getFieldNames() as $field) {
            $type = $this->getClassMetadata()->getTypeOfField($field);
            if (in_array($type, $types)) {
                $result[] = $field;
            }
        }
        // calculate intersection
        if (!is_null($intersectArray)) {
            $result = array_intersect($result, $intersectArray);
        }

        return $result;
    }
public function getFieldsWitTypes ( array $ types , $ intersectArray = null ) { $ result = [ ] ; foreach ( $ this -> getClassMetadata ( ) -> getFieldNames ( ) as $ field ) { $ type = $ this -> getClassMetadata ( ) -> getTypeOfField ( $ field ) ; if ( in_array ( $ type , $ types ) ) { $ result [ ] = $ field ; } } // calculate intersection if ( ! is_null ( $ intersectArray ) ) { $ result = array_intersect ( $ result , $ intersectArray ) ; } return $ result ; }
returns all fields with a specified type.

@param array $types
@param null $intersectArray only return fields that are defined in this array

@return array
returns all fields with a specified type .