table with 2 primary keys update problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: table with 2 primary keys update problem (/showthread.php?tid=76439) |
table with 2 primary keys update problem - wdeda - 05-12-2020 Hi! I have a table with two primary keys, but no foreign keys and the table update is showing an error depending on the configuration of "protected $primaryKey". If I remove "protected $primaryKey" it displays an error message but updates {else} it displays an error message and does not update. Is it valid or possible to inform both primary keys? Model: Code: <? php namespace App \ Models; Pleas, any suggestion? RE: table with 2 primary keys update problem - wdeda - 05-12-2020 Update: When "$model->save" is used the problem occurs exactly as described above; if the option is $model->insert with or without the primary key, the error message occurs but the table is updated. Controller: Code: public function artrec() { RE: table with 2 primary keys update problem - vitnibel - 05-12-2020 In both screenshots, an exception occurs due to "forInvalidFile", when rendering one of the views: PHP Code: echo view('templates/headerx', $header); Perhaps one or more files were not found or are not where you indicated RE: table with 2 primary keys update problem - wdeda - 05-15-2020 (05-12-2020, 07:14 PM)vitnibel Wrote: In both screenshots, an exception occurs due to "forInvalidFile", when rendering one of the views: This was a great nonsense for those who were starting, 2015, of course, until today, things have not changed that much. The correct one would be a single primary key, id. The two fields, without attributes, are sufficient to make the relationship between player and record, as can be seen below. Code: public function getAlbums() { I should have already presented the solution but I was in the final steps of converting my site, localhost, from CI3 to CI4, just finished. I can't believe I did it. Thank you very much for your attention |