I have models: Activity and Map, there is such relation: Activity:
$this->hasOne('id', 'Activity\Map', 'activity_id', [ 'alias' => 'map', 'reusable' => true, 'foreignKey' => [ 'action' => Relation::ACTION_CASCADE ] ]);
$this->belongsTo('activity_id', 'Activity\Activity', 'id', [ 'alias' => 'activity', 'reusable' => true, 'foreignKey' => [ 'allowNulls' => false, 'message' => 'The activity doest not exist.' ] ]);
When I delete object Activity, then related Map is deleted also, this works fine. Should I create foreign key on database and table map? Because when I created such foreign key, then related Map was deleted via this FK, not via Phalcon relation. Which way is good?