src/Utility/Search.php
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;
    }
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;
    }
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 ; }
Search by current Table associations.

@param mixed[] $data Search data
@return mixed[]
Search by current Table associations .