Hello,
I have a problem with Cortex.
I am currently creating a tool for managing files. For this, newly created files have to be entered into another table.
I try the following:
$file = new \Model\File()
$file->name = 'test';
...
$file->save();
$history = new \Model\EditHistory();
$history->file = $file;
...
$history->save();
This procedure fails, however. Apparently the file model is reset after Save(), in any case $file->_id is null.
So I have no possibility to get the new id. Although I could use lastinsertid() from the DB, this leads to errors (wrong IDs) with many-to-many relations.
Also the attempt to use the returned model of the save method fails.
The problem only exists if I use postgresql. With MYsql, everything works well, but for this project, I have to use postgres.
My system: Debian10, Cortex 1.7 (also tested with latest master commit), F3 3.7.2, Apache2, PHP 7.4. It also fails with psql 12 on Windows.
Is there a solution for this problem or am I doing something wrong?
Thanks and greetings
Adrian Kurz