protected function byAssociations(array $data): array
    {
        $result = [];
        foreach ($this->getAssociationsBySearchData($data) as $association) {
            // skip non-supported associations
            if (!in_array($association->type(), Options::getSearchableAssociations())) {
                continue;
            }

            $targetTable = $association->getTarget();

            // skip associations with itself
            if ($targetTable->getTable() === $this->table->getTable()) {
                continue;
            }

            $primaryKeys = [];
            foreach ((array)$targetTable->getPrimaryKey() as $primaryKey) {
                $primaryKeys[] = $targetTable->aliasField($primaryKey);
            }

            // instantiate Search on related table
            $search = new Search($targetTable, $this->user);

            $select = array_diff($search->getSelectClause($data), $primaryKeys);
            if (!empty($select)) {
                $result[$association->getName()]['select'] = $select;
            }

            $where = $search->getWhereClause($data);
            if (!empty($where)) {
                $result[$association->getName()]['where'] = $where;
            }
        }

        return $result;
    }