From c1011d6958bd3d5cfaf760aa248cd1eb7f73d62e Mon Sep 17 00:00:00 2001 From: sergeysviridenko Date: Fri, 18 Aug 2017 19:24:06 +0300 Subject: [PATCH] Added deleting permissions when profile was deleted --- app/models/Profiles.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/Profiles.php b/app/models/Profiles.php index 3035f4d6..b32cccae 100644 --- a/app/models/Profiles.php +++ b/app/models/Profiles.php @@ -2,6 +2,7 @@ namespace Vokuro\Models; use Phalcon\Mvc\Model; +use Phalcon\Mvc\Model\Relation; /** * Vokuro\Models\Profiles @@ -35,7 +36,10 @@ public function initialize() ]); $this->hasMany('id', __NAMESPACE__ . '\Permissions', 'profilesId', [ - 'alias' => 'permissions' + 'alias' => 'permissions', + 'foreignKey' => [ + 'action' => Relation::ACTION_CASCADE + ] ]); } }