# |
Jun 8th 2019, 15:59 |
loginews |
The link you just gave is interesting |
# |
Jun 8th 2019, 15:58 |
loginews |
I have used custom sql queries before, by calling the connection manager |
# |
Jun 8th 2019, 15:55 |
loginews |
that would be a solution, except that I thought that once I manage to list what I am looking for in a find(), deleting them all would have been a simple operation. |
# |
Jun 8th 2019, 15:54 |
graziel |
second one will be a bit slower but imo easier |
# |
Jun 8th 2019, 15:54 |
graziel |
or just write query in orm and iterate over results with `$this->Rep06->delete($entity);` |
# |
Jun 8th 2019, 15:53 |
graziel |
you can use sql expression you write yourself if you want speed https://book.cakephp.org/3.0/en/orm/database-basics.html#running-delete-statements |
# |
Jun 8th 2019, 15:51 |
loginews |
the above snippet is the model table for rep06 |
# |
Jun 8th 2019, 15:51 |
loginews |
I want to delete all records in cptran where cshdet is not linked and is null. |
# |
Jun 8th 2019, 15:50 |
loginews |
that would not work, because : |
# |
Jun 8th 2019, 15:50 |
graziel |
$this0>Cshdet->deleteAll(['DOCNO IS NULL']); |
# |
Jun 8th 2019, 15:49 |
loginews |
I want to delete all the records. |
# |
Jun 8th 2019, 15:49 |
loginews |
My index function is like this |
# |
Jun 8th 2019, 15:49 |
graziel |
hm then you want to delete records from cshdet table not rep06 |
# |
Jun 8th 2019, 15:48 |
loginews |
now it says: Unknown column 'cshdet.DOCNO' in 'where clause' |
# |
Jun 8th 2019, 15:46 |
loginews |
let me remove it and see |
# |
Jun 8th 2019, 15:46 |
loginews |
yeah, it refuses. |
# |
Jun 8th 2019, 15:45 |
graziel |
also cant use contain in there |
# |
Jun 8th 2019, 15:45 |
loginews |
let me try... |
# |
Jun 8th 2019, 15:45 |
graziel |
$this->Rep06->deleteAll() |
# |
Jun 8th 2019, 15:44 |
loginews |
I have tried this, but it throws call to undefined function deleteAll |
# |
Jun 8th 2019, 15:41 |
graziel |
its table method not query https://book.cakephp.org/3.0/en/orm/deleting-data.html#bulk-deletes |
# |
Jun 8th 2019, 15:39 |
loginews |
:,( |
# |
Jun 8th 2019, 15:35 |
loginews |
Or do I need to put use Cake\ORM\something in my controller ? |
# |
Jun 8th 2019, 15:34 |
loginews |
I have tried to put this function in the controller, but it throws the error i mentioned |
# |
Jun 8th 2019, 15:30 |
loginews |
I keep getting "unknown method deleteAll" |
# |
Jun 8th 2019, 14:57 |
loginews |
@challgren Rep06 is not a table but a query based on cptran and cshdet tables. See snippet. My difficulty is just how to call DeleteAll from a function repair() in Rep06Controller |
# |
Jun 8th 2019, 08:41 |
challgren |
Are you trying to delete from the Repo06 table or the cshdet table? |
# |
Jun 8th 2019, 08:29 |
loginews |
thanks I will try later |
# |
Jun 8th 2019, 08:21 |
challgren |
The deleteAll accepts the same finder conditions |
# |
Jun 8th 2019, 08:20 |
challgren |
@loginews yes you can delete records returned by find, you just need to rerun your find in the other controller action |
# |
Jun 8th 2019, 07:57 |
loginews |
I had been to those docs. Apparently the entity will have to select the records already... We apparently cannot delete records returned by Find() |
# |
Jun 8th 2019, 07:55 |
loginews |
I don't want to. Have not been here for a long time. I had a specific difficulty today. Sorry to disturb the great minds. |
# |
Jun 8th 2019, 07:55 |
dakota |
@loginews https://book.cakephp.org/3.0/en/orm/deleting-data.html#bulk-deletes |
# |
Jun 8th 2019, 07:54 |
megan |
@loginews please don't tag specific people - rather just ask your question and if someone is available that can help, they will |
# |
Jun 8th 2019, 07:52 |
loginews |
@chris-andre: are you part of the support team ? |
# |
Jun 8th 2019, 07:51 |
loginews |
@dereuromark you here ? |
# |
Jun 8th 2019, 07:46 |
loginews |
I have a model between table cptran and table cshdet. The index displays a subset returned by the find() function. I want to add a function in the controller called repair() which will delete all the records returned by find().Is that possible? |
# |
Jun 8th 2019, 06:19 |
JDD_Canada |
That is coming up 404 |
# |
Jun 7th 2019, 22:38 |
challgren |
Debug it as much as possible and if you can fix it do a PR |
# |
Jun 7th 2019, 22:37 |
rightscoreanalysis |
looks like a problem with the TinyAuth plugin |
# |
Jun 7th 2019, 22:36 |
challgren |
Ohh ok I was just wondering if maybe it was a Plugin and you didnt have your allow_auth to include the Plugin, Sorry cant be much more help than that |