src/Utility/BasicSearch.php
protected function getRelatedFieldValue(string $field, string $value): array
    {
        $table = TableRegistry::get($this->searchFields[$field]['source']);

        // avoid infinite recursion
        if ($this->table->getAlias() === $table->getAlias()) {
            return [];
        }

        $search = new Search($table, $this->user);
        $basicSearch = new BasicSearch($table, $this->user);

        $criteria = $basicSearch->getCriteria($value);
        if (empty($criteria)) {
            return [];
        }

        $data = [
            'aggregator' => 'OR',
            'criteria' => $criteria
        ];

        $resultSet = $search->execute($data)->all();
        if ($resultSet->isEmpty()) {
            return [];
        }

        $result = [];
        foreach ($resultSet as $entity) {
            $result[] = $entity->id;
        }

        return [
            'type' => $this->searchFields[$field]['type'],
            'operator' => key($this->searchFields[$field]['operators']),
            'value' => $result
        ];
    }
protected function getRelatedFieldValue(string $field, string $value): array
    {
        $table = TableRegistry::get($this->searchFields[$field]['source']);

        // avoid infinite recursion
        if ($this->table->getAlias() === $table->getAlias()) {
            return [];
        }

        $search = new Search($table, $this->user);
        $basicSearch = new BasicSearch($table, $this->user);

        $criteria = $basicSearch->getCriteria($value);
        if (empty($criteria)) {
            return [];
        }

        $data = [
            'aggregator' => 'OR',
            'criteria' => $criteria
        ];

        $resultSet = $search->execute($data)->all();
        if ($resultSet->isEmpty()) {
            return [];
        }

        $result = [];
        foreach ($resultSet as $entity) {
            $result[] = $entity->id;
        }

        return [
            'type' => $this->searchFields[$field]['type'],
            'operator' => key($this->searchFields[$field]['operators']),
            'value' => $result
        ];
    }
protected function getRelatedFieldValue ( string $ field , string $ value ) : array { $ table = TableRegistry :: get ( $ this -> searchFields [ $ field ] [ 'source' ] ) ; // avoid infinite recursion if ( $ this -> table -> getAlias ( ) === $ table -> getAlias ( ) ) { return [ ] ; } $ search = new Search ( $ table , $ this -> user ) ; $ basicSearch = new BasicSearch ( $ table , $ this -> user ) ; $ criteria = $ basicSearch -> getCriteria ( $ value ) ; if ( empty ( $ criteria ) ) { return [ ] ; } $ data = [ 'aggregator' => 'OR' , 'criteria' => $ criteria ] ; $ resultSet = $ search -> execute ( $ data ) -> all ( ) ; if ( $ resultSet -> isEmpty ( ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ resultSet as $ entity ) { $ result [ ] = $ entity -> id ; } return [ 'type' => $ this -> searchFields [ $ field ] [ 'type' ] , 'operator' => key ( $ this -> searchFields [ $ field ] [ 'operators' ] ) , 'value' => $ result ] ; }
Gets basic search values from Related module.

This method is useful when you do a basic search on a related field,
in which the values are always uuid's. What this method will do is
run a search in the related module (recursively) to fetch and
return the entities IDs matching the search string.

@param string $field Field name
@param string $value Search query value
@return mixed[]
Gets basic search values from Related module .