private function getAssociationsBySearchData(array $data) : array
    {
        $fields = [];
        if (array_key_exists('criteria', $data)) {
            foreach (array_keys($data['criteria']) as $field) {
                $field = $this->table->aliasField((string)$field);
                if (! in_array($field, $fields)) {
                    $fields[] = $field;
                }
            }
        }

        if (array_key_exists('display_columns', $data)) {
            foreach ($data['display_columns'] as $field) {
                if (is_string($field) && ! in_array($field, $fields)) {
                    $fields[] = $field;
                }
            }
        }

        $result = [];
        foreach ($fields as $field) {
            list($name) = explode('.', $this->table->aliasField($field), 2);

            if ($name === $this->table->getAlias()) {
                continue;
            }

            if (! $this->table->hasAssociation($name)) {
                throw new \RuntimeException(sprintf('Table "%s" does not have association "%s"', $this->table->getAlias(), $name));
            }

            $association = $this->table->getAssociation($name);

            if (array_key_exists($association->getName(), $result)) {
                continue;
            }

            $result[$association->getName()] = $association;
        }

        return $result;
    }