Sunday, January 3, 2016

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

Running cakePHP 3.1.1

Well, I have to admit I really don't understand this...  I removed the comments around the deleteAll code above, and commented out the loop of ->deletes.  Now, I cannot recreate the error!

I checked my git repository, and there were no changes to the code, so maybe it has something to do with cache.  There has been a reboot of the system since I was encountering the problem. 

This question should probably be marked ignore!

Sorry to waste your time on another non-problem.


On Sunday, January 3, 2016 at 12:27:21 PM UTC-7, José Lorenzo wrote:
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: