Quantcast

CakePHP 3.1.1 - deleteAll when using condition NOT IN array fails

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
glk
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CakePHP 3.1.1 - deleteAll when using condition NOT IN array fails

glk
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

José Lorenzo
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
glk
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

glk
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

José Lorenzo
Ok, you ask again if you stumble upon the problem again :)

On Sunday, January 3, 2016 at 10:35:49 PM UTC+1, glk wrote:
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
Loading...