Sunday, January 3, 2016

Re: CakePHP 3.1.1 - deleteAll when using condition NOT IN array fails

What version of cakephp are you using? What is the full error and the SQL query?

On Tuesday, December 29, 2015 at 7:54:41 PM UTC+1, glk wrote:
Hello,

A function in OpSpTable.php uses the following code:

            $op_id = 18;
            $actualUsed = [2, 101];
 
            $conditions = [
                'OpSps.op_id'             => $op_id,
                'OptSps.ec_id NOT IN' => $actualUsed,
            ];

            $results = $this->deleteAll($conditions);

 
The exception thrown is about MySQL not understanding what's going on at '1)'

To fix the issue temporarily, I have done a query to get an array of OpSps.oc_id and then performed a loop with ->get and then ->delete.  But this seems like overkill.  Is there something wrong with the use of NOT IN withing the deleteAll?

Thanks for any input... I've worked around the issue, but don't understand why I had to?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: