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

Check if table content exist or not

Hi,

how can I check, if a set of data already exist in table? The insert with save() function is working.

Is there an example, I don't find anything.

Rgds

Stefan



6.9k

You can add validation to your model that checks for unique-ness.

See the model reference docs detailing the validations, pay attention to the uniqueness validator detailed in the code example.