Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit bcbc1ff

Browse files
committed
Add relations queries to query options
1 parent fef95cc commit bcbc1ff

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/Util/RequestOptions.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,7 @@ public static function parse($options)
101101
}
102102

103103
if (array_key_exists('relationships_conditions', $options)) {
104-
$query .= 'rq=';
105-
foreach ($options['relationships_conditions'] as $condition) {
106-
$query .= $condition == end($options['relationships_conditions']) ? $condition : $condition . ',';
107-
}
108-
$query .= '&';
104+
$query .= self::parseRelationshipsCustomConditions($options['relationships_conditions']);
109105
}
110106

111107
if (array_key_exists('sort', $options)) {
@@ -171,4 +167,18 @@ private function parseCustomConditions(array $conditions): string
171167

172168
return $query;
173169
}
170+
171+
/**
172+
* Parse custom conditions Params.
173+
* @param array $relationships
174+
* @return string
175+
* @todo Maybe we can improve this better later.
176+
*/
177+
private function parseRelationshipsCustomConditions(array $conditions): string
178+
{
179+
foreach ($conditions as $key => $value) {
180+
181+
return $query = 'rq=[' . $key . ']=(' . $value . ')&';
182+
}
183+
}
174184
}

0 commit comments

Comments
 (0)