Skip to content

Commit 1d150c9

Browse files
committed
address comments
1 parent 89f6fee commit 1d150c9

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

src/Database/Adapter/SQL.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3195,10 +3195,6 @@ public function find(
31953195
{$sqlLimit};
31963196
";
31973197

3198-
if (!empty($sqlJoin)) {
3199-
var_dump($sql);
3200-
}
3201-
32023198
$sql = $this->trigger(Database::EVENT_DOCUMENT_FIND, $sql);
32033199

32043200
try {

src/Database/Database.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8284,15 +8284,15 @@ public function find(string $collection, array $queries = [], string $forPermiss
82848284
);
82858285
}
82868286

8287-
foreach ($context->getCollections() as $_collection) {
8288-
$documentSecurity = $_collection->getAttribute('documentSecurity', false);
8289-
$skipAuth = $this->authorization->isValid(new Input($forPermission, $_collection->getPermissionsByType($forPermission)));
8287+
foreach ($context->getCollections() as $contextCollection) {
8288+
$documentSecurity = $contextCollection->getAttribute('documentSecurity', false);
8289+
$skipAuth = $this->authorization->isValid(new Input($forPermission, $contextCollection->getPermissionsByType($forPermission)));
82908290

8291-
if (!$skipAuth && !$documentSecurity && $_collection->getId() !== self::METADATA) {
8291+
if (!$skipAuth && !$documentSecurity && $contextCollection->getId() !== self::METADATA) {
82928292
throw new AuthorizationException($this->authorization->getDescription());
82938293
}
82948294

8295-
$context->addSkipAuth($this->adapter->filter($_collection->getId()), $forPermission, $skipAuth);
8295+
$context->addSkipAuth($this->adapter->filter($contextCollection->getId()), $forPermission, $skipAuth);
82968296
}
82978297

82988298
$this->checkQueryTypes($queries);
@@ -8554,15 +8554,15 @@ public function count(string $collection, array $queries = [], ?int $max = null)
85548554
);
85558555
}
85568556

8557-
foreach ($context->getCollections() as $_collection) {
8558-
$documentSecurity = $_collection->getAttribute('documentSecurity', false);
8557+
foreach ($context->getCollections() as $contextCollection) {
8558+
$documentSecurity = $contextCollection->getAttribute('documentSecurity', false);
85598559
$skipAuth = $this->authorization->isValid(new Input(self::PERMISSION_READ, $_collection->getRead()));
85608560

8561-
if (!$skipAuth && !$documentSecurity && $_collection->getId() !== self::METADATA) {
8561+
if (!$skipAuth && !$documentSecurity && $contextCollection->getId() !== self::METADATA) {
85628562
throw new AuthorizationException($this->authorization->getDescription());
85638563
}
85648564

8565-
$context->addSkipAuth($this->adapter->filter($_collection->getId()), self::PERMISSION_READ, $skipAuth);
8565+
$context->addSkipAuth($this->adapter->filter($contextCollection->getId()), self::PERMISSION_READ, $skipAuth);
85668566
}
85678567

85688568
$this->checkQueryTypes($queries);
@@ -8792,11 +8792,11 @@ public function decode(QueryContext $context, Document $document, array $selects
87928792
$internals[$attribute['$id']] = $attribute;
87938793
}
87948794

8795-
foreach ($context->getCollections() as $collection) {
8796-
foreach ($collection->getAttribute('attributes', []) as $attribute) {
8795+
foreach ($context->getCollections() as $contextCollection) {
8796+
foreach ($contextCollection->getAttribute('attributes', []) as $attribute) {
87978797
$key = $attribute->getAttribute('key', $attribute->getAttribute('$id'));
87988798
$key = $this->adapter->filter($key);
8799-
$schema[$collection->getId()][$key] = $attribute->getArrayCopy();
8799+
$schema[$contextCollection->getId()][$key] = $attribute->getArrayCopy();
88008800
}
88018801
}
88028802

@@ -8891,11 +8891,11 @@ public function casting(QueryContext $context, Document $document, array $select
88918891
$internals[$attribute['$id']] = $attribute;
88928892
}
88938893

8894-
foreach ($context->getCollections() as $collection) {
8895-
foreach ($collection->getAttribute('attributes', []) as $attribute) {
8894+
foreach ($context->getCollections() as $contextCollection) {
8895+
foreach ($contextCollection->getAttribute('attributes', []) as $attribute) {
88968896
$key = $attribute->getAttribute('key', $attribute->getAttribute('$id'));
88978897
$key = $this->adapter->filter($key);
8898-
$schema[$collection->getId()][$key] = $attribute->getArrayCopy();
8898+
$schema[$contextCollection->getId()][$key] = $attribute->getArrayCopy();
88998899
}
89008900
}
89018901

0 commit comments

Comments
 (0)