Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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?



1.5k
Accepted
answer

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