Relational Active Record Without Foreign Key

I’m not using foreign key relationship in any of my tables. The related objects in relations() method of CActiveRecord are defined as ‘varName’=>array(‘relationType’, ‘className’, ‘foreign_key’, …additional options). Is foreign key element required or optional ?

You don’t need to create the foreign key in the database to use AR relations. You do need to specify the column to use as the foreign key when setting up the relations though.