src/Utility.php
public function formatter(ResultSetInterface $resultSet, array $fields, RepositoryInterface $table, array $user) : array
    {
        $result = [];

        if ($resultSet->isEmpty()) {
            return $result;
        }

        $cakeView = new View();
        $registryAlias = $table->getRegistryAlias();
        $alias = $table->getAlias();

        foreach ($resultSet as $key => $entity) {
            foreach ($fields as $field) {
                list($tableName, $fieldName) = explode('.', $field);
                // current table field
                if ($alias === $tableName) {
                    $result[$key][$field] = $entity->get($fieldName);
                    continue;
                }

                if (!$entity->get('_matchingData')) {
                    continue;
                }

                if (!isset($entity->_matchingData[$tableName])) {
                    continue;
                }
                // associated table field
                $result[$key][$field] = $entity->_matchingData[$tableName]->get($fieldName);
            }

            $result[$key][static::MENU_PROPERTY_NAME] = $cakeView->element('Search.Menu/search-view-actions', [
                'entity' => $entity,
                'model' => $registryAlias,
                'user' => $user
            ]);
        }

        return $result;
    }
public function formatter(ResultSetInterface $resultSet, array $fields, RepositoryInterface $table, array $user) : array
    {
        $result = [];

        if ($resultSet->isEmpty()) {
            return $result;
        }

        $cakeView = new View();
        $registryAlias = $table->getRegistryAlias();
        $alias = $table->getAlias();

        foreach ($resultSet as $key => $entity) {
            foreach ($fields as $field) {
                list($tableName, $fieldName) = explode('.', $field);
                // current table field
                if ($alias === $tableName) {
                    $result[$key][$field] = $entity->get($fieldName);
                    continue;
                }

                if (!$entity->get('_matchingData')) {
                    continue;
                }

                if (!isset($entity->_matchingData[$tableName])) {
                    continue;
                }
                // associated table field
                $result[$key][$field] = $entity->_matchingData[$tableName]->get($fieldName);
            }

            $result[$key][static::MENU_PROPERTY_NAME] = $cakeView->element('Search.Menu/search-view-actions', [
                'entity' => $entity,
                'model' => $registryAlias,
                'user' => $user
            ]);
        }

        return $result;
    }
public function formatter ( ResultSetInterface $ resultSet , array $ fields , RepositoryInterface $ table , array $ user ) : array { $ result = [ ] ; if ( $ resultSet -> isEmpty ( ) ) { return $ result ; } $ cakeView = new View ( ) ; $ registryAlias = $ table -> getRegistryAlias ( ) ; $ alias = $ table -> getAlias ( ) ; foreach ( $ resultSet as $ key => $ entity ) { foreach ( $ fields as $ field ) { list ( $ tableName , $ fieldName ) = explode ( '.' , $ field ) ; // current table field if ( $ alias === $ tableName ) { $ result [ $ key ] [ $ field ] = $ entity -> get ( $ fieldName ) ; continue ; } if ( ! $ entity -> get ( '_matchingData' ) ) { continue ; } if ( ! isset ( $ entity -> _matchingData [ $ tableName ] ) ) { continue ; } // associated table field $ result [ $ key ] [ $ field ] = $ entity -> _matchingData [ $ tableName ] -> get ( $ fieldName ) ; } $ result [ $ key ] [ static :: MENU_PROPERTY_NAME ] = $ cakeView -> element ( 'Search.Menu/search-view-actions' , [ 'entity' => $ entity , 'model' => $ registryAlias , 'user' => $ user ] ) ; } return $ result ; }
Method that formats resultset.

@param \Cake\Datasource\ResultSetInterface $resultSet ResultSet
@param string[] $fields Display fields
@param \Cake\Datasource\RepositoryInterface $table Table instance
@param mixed[] $user User info
@return mixed[]
Method that formats resultset .