Question

I have a table called notifications in my DB and a table called notes. Notifications has a foreign key reference on notes, I want CakePHP to recognize that this value can be null, do I need to set anything up in my model for this to take effect? Or only the constraint on the DB is required?

Was it helpful?

Solution

I do this fairly frequently. The only problem that you'll run into is that Cake stores empty values as empty strings which is bad for foreign keys. I wrote a simple, stupid NullableBehavior to fix that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top