From 37edba8dbc7ef52562414a9e6088480ae6758ff7 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 21 May 2025 14:10:35 +0200 Subject: [PATCH] Improve comments --- src/RLS/PolicyManagers/TableRLSManager.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/RLS/PolicyManagers/TableRLSManager.php b/src/RLS/PolicyManagers/TableRLSManager.php index 1998e9ea..1442b0db 100644 --- a/src/RLS/PolicyManagers/TableRLSManager.php +++ b/src/RLS/PolicyManagers/TableRLSManager.php @@ -110,8 +110,6 @@ class TableRLSManager implements RLSPolicyManager protected function generatePaths(string $table, array $foreign, array &$paths, array $currentPath = []): void { - // If the foreign key has a comment of 'no-rls', we skip it - // Also skip the foreign key if implicit scoping is off and the foreign key has no comment if ($this->shouldSkipPathLeadingThrough($foreign)) { return; } @@ -137,8 +135,9 @@ class TableRLSManager implements RLSPolicyManager protected function shouldSkipPathLeadingThrough(array $foreignKey): bool { - // If the foreign key has a comment of 'no-rls', we skip it - // Also skip the foreign key if implicit scoping is off and the foreign key has no comment + // If the column has a comment of 'no-rls', we skip it. + // Also skip the column if implicit scoping is off and the column + // has no 'rls' comment or is not recognized as a comment constraint (its comment doesn't begin with 'rls '). $pathExplicitlySkipped = $foreignKey['comment'] === 'no-rls'; $pathImplicitlySkipped = ! static::$scopeByDefault && ( ! isset($foreignKey['comment']) ||