delete from multiple tables datamapper codeigniter
up vote
0
down vote
favorite
I have a problem with the datamapper on codeigniter, i would like to delete all the records from 3 tables with the relation. Something like:
$c = new Camp();
$c->where('id', $this->input->post('id'))->get();
$cf = new CF();
$cf->where('camp_id', $this->input->post('id'))->get();
$p = new Pro();
$p->where('camp_id', $this->input->post('id'))->get();
$c->delete(array($cf, $p->all));
This give me a problem, but if i do individually, adding a delete or delete_all after the where:
$c = new Camp();
$c->where('id', $this->input->post('id'))->get();
$c->delete();
$cf = new CF();
$cf->where('camp_id', $this->input->post('id'))->get();
$cf->delete();
$p = new Pro();
$p->where('camp_id', $this->input->post('id'))->get();
$p->delete_all();
it not delete the records from the table, it just put as null the field camp_id where is more than a record, in this case, in the p->delete_all, and i would like to delete from the table. I could do with codeigniter, but i must do with the datamapper. Someone know how to do it?
Thanks.
php codeigniter datamapper
add a comment |
up vote
0
down vote
favorite
I have a problem with the datamapper on codeigniter, i would like to delete all the records from 3 tables with the relation. Something like:
$c = new Camp();
$c->where('id', $this->input->post('id'))->get();
$cf = new CF();
$cf->where('camp_id', $this->input->post('id'))->get();
$p = new Pro();
$p->where('camp_id', $this->input->post('id'))->get();
$c->delete(array($cf, $p->all));
This give me a problem, but if i do individually, adding a delete or delete_all after the where:
$c = new Camp();
$c->where('id', $this->input->post('id'))->get();
$c->delete();
$cf = new CF();
$cf->where('camp_id', $this->input->post('id'))->get();
$cf->delete();
$p = new Pro();
$p->where('camp_id', $this->input->post('id'))->get();
$p->delete_all();
it not delete the records from the table, it just put as null the field camp_id where is more than a record, in this case, in the p->delete_all, and i would like to delete from the table. I could do with codeigniter, but i must do with the datamapper. Someone know how to do it?
Thanks.
php codeigniter datamapper
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a problem with the datamapper on codeigniter, i would like to delete all the records from 3 tables with the relation. Something like:
$c = new Camp();
$c->where('id', $this->input->post('id'))->get();
$cf = new CF();
$cf->where('camp_id', $this->input->post('id'))->get();
$p = new Pro();
$p->where('camp_id', $this->input->post('id'))->get();
$c->delete(array($cf, $p->all));
This give me a problem, but if i do individually, adding a delete or delete_all after the where:
$c = new Camp();
$c->where('id', $this->input->post('id'))->get();
$c->delete();
$cf = new CF();
$cf->where('camp_id', $this->input->post('id'))->get();
$cf->delete();
$p = new Pro();
$p->where('camp_id', $this->input->post('id'))->get();
$p->delete_all();
it not delete the records from the table, it just put as null the field camp_id where is more than a record, in this case, in the p->delete_all, and i would like to delete from the table. I could do with codeigniter, but i must do with the datamapper. Someone know how to do it?
Thanks.
php codeigniter datamapper
I have a problem with the datamapper on codeigniter, i would like to delete all the records from 3 tables with the relation. Something like:
$c = new Camp();
$c->where('id', $this->input->post('id'))->get();
$cf = new CF();
$cf->where('camp_id', $this->input->post('id'))->get();
$p = new Pro();
$p->where('camp_id', $this->input->post('id'))->get();
$c->delete(array($cf, $p->all));
This give me a problem, but if i do individually, adding a delete or delete_all after the where:
$c = new Camp();
$c->where('id', $this->input->post('id'))->get();
$c->delete();
$cf = new CF();
$cf->where('camp_id', $this->input->post('id'))->get();
$cf->delete();
$p = new Pro();
$p->where('camp_id', $this->input->post('id'))->get();
$p->delete_all();
it not delete the records from the table, it just put as null the field camp_id where is more than a record, in this case, in the p->delete_all, and i would like to delete from the table. I could do with codeigniter, but i must do with the datamapper. Someone know how to do it?
Thanks.
php codeigniter datamapper
php codeigniter datamapper
edited Nov 7 at 12:29
asked Nov 7 at 7:53
Imanol
12
12
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185388%2fdelete-from-multiple-tables-datamapper-codeigniter%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password