Method find() class DatabaseTable... changed

I modified the find() method to be able to apply to the select query all the search options (for example the operators greater-equal than (=>), less-equal than (<=)) and the conditions (AND, OR, LIKE , BETWEEN):

public function find(array $columns, $op, $cond = ' AND ', $orderBy = null, $limit = null, $offset = null) {
    $searchParts = [];
    $parameters = [];

    if (is_array($op)) {
        $i = 0;
        foreach ($columns as $column => $value) {
            $searchParts[] = $column . $op[$i] . ' :'.$column;
            $parameters[$column] = $value;
            $i++;
        }
    } else {
        $op = ' =';
        foreach ($columns as $column => $value) {
            $searchParts[] = $column . $op . ' :'.$column;
            $parameters[$column] = $value;
        }
    }
        
    $query = 'SELECT * FROM ' . $this->table . ' WHERE ' . implode($searchParts, $cond);

    if ($orderBy != null) {
        $query .= ' ORDER BY ' . $orderBy;
    }

    if ($limit != null) {
        $query .= ' LIMIT ' . $limit;
    }

    if ($offset != null) {
        $query .= ' OFFSET ' . $offset;
    }

    $query = $this->query($query, $parameters);

    return $query->fetchAll(\PDO::FETCH_CLASS, $this->className, $this->constructorArgs);
}

method call examples:

$colonne = [
    'ID_Campionato' => $this->camp->ID_Campionato
];

$news = $this->newsTable->find($colonne, null, null, null, 10, $offset);
$op = [
    ' <='
];

return $this->giornateTable->find($columns, $op, null, ' Data DESC', 1);

I did some testing and the method works
I don’t know if I did it right… surely it can be improved… but it’s probably out of my current capabilities

bye