Say I have 2 tables, A and B.
B has a foreign key from A.
Whenever I insert data to table B, I should check availability of foreign key in the table A.
Is there any way to do this process instead of doing it manually ?
I have googled it by myself, and found that CExistValidator is probably what I want.
But I didn’t find any comprehensive example for use of that validator.
If CExistValidator is the answer, can you give me some example ?
Thanks.
Let’s say you have a class
Categorywhich has manyPages. You want to ensure thatPagebelongs to some existingCategory: