CodeCabin / wp-google-maps

WP Google Maps
16 stars 12 forks source link

Query::build() #983

Closed shazahm1 closed 2 years ago

shazahm1 commented 4 years ago

This is not processing the groupBy attribute. Currently it is:

            $where = $query->_where->toArray();
            if(!empty($where))
                $qstr .= " WHERE " . implode(' AND ', $where);

            $having = $query->_having->toArray();
            if(!empty($having))
                $qstr .= " HAVING " . implode(' AND ', $having);

And probably should be this:

            $where = $query->_where->toArray();
            if(!empty($where))
                $qstr .= " WHERE " . implode(' AND ', $where);

            $group = $query->_groupBy->toArray();
            if(!empty($group))
                $qstr .= " GROUP BY " . implode(', ', $group);

            $having = $query->_having->toArray();
            if(!empty($having))
                $qstr .= " HAVING " . implode(' AND ', $having);
DylanCodeCabin commented 2 years ago

Thank you for your report. I am sorry this slipped by us!

The issue should have been resolved from the time it was logged. We are cleaning up this repo in an attempt to reorganize and open a line of communication with reporters.

As a result, this issue is being closed as stale - You can learn more about the future of this repo here:

Basically, we will be removing all issues, moving relevant items to our internal V9 repo and solving them further there. Once V9 is released to the public, this repo will become more active with issue tracking and enhancement requests

shazahm1 commented 2 years ago

@DylanCodeCabin

As of WPGM version 8.1.20 (current of this post), this bug still exists.

And related...

\WPGMZA\Query has an private $_orderBy; that is not being processed in the build() method.

This:


        if(!empty($this->_limit))
            $qstr .= " LIMIT {$this->_limit}";

        return $qstr;

should be this:

        $orderBy = $query->_orderBy->toArray();
        if(!empty($orderBy))
            $qstr .= " ORDER BY " . implode(', ', $orderBy);  

        if(!empty($this->_limit))
            $qstr .= " LIMIT {$this->_limit}";

        return $qstr;

Or perhaps something a little more intelligent to parse the fields to order by and the sort order flags (ASC|DESC).

DylanCodeCabin commented 2 years ago

Thank you for reconfirming @shazahm1 -> I'm reopening the issue and we'll get this sorted as soon as possible.

It does seem the processing here was only partially developed, I still need to confirm why that may have been, but as of now I don't see any reason why it shouldn't be fixed.

DylanCodeCabin commented 2 years ago

I've added the missing values and they are now supported by the method.

Confirmed release date of 2022-06-20

Thank you @shazahm1