We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Cannot delete record in database - A primary key must be defined in the model in order to perform the operation

I am migrating an application that was made in CodeIgniter for Phalcon. I could, without problems, delete the records from this table using a reference to another table (DELETE FROM TABLE1 WHERE FIELD1 IN (SELECT FIELD2 FROM TABLE2)).

Both do not have primary keys. And is EXTERNAL TABLE.

How do I proceed? I can do the Phalcon ignore it?



2.5k
Accepted
answer

Ok. I used Phalcon\Mvc\Model\Resultset\Simple and it worked perfectly.