Skip to content

Commit a2dd614

Browse files
authored
Merge pull request #82 from cyrila-eukles/fix-query-modifier-join-type
fix(QueryModifier): always use left join criteria on orderBy
2 parents e8c43bb + 6569454 commit a2dd614

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Service/QueryModifier/Easy/Modifier.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function methodExists($method)
7979
*/
8080
public function orderBy(string $dotProperty, $order = Criteria::ASC): ModelCriteria
8181
{
82-
$property = $this->before($dotProperty);
82+
$property = $this->before($dotProperty, Criteria::LEFT_JOIN);
8383
$method = $this->buildMethodName(__FUNCTION__, $property);
8484
try{
8585
$this->query = $this->query->{$method}($order);
@@ -111,19 +111,19 @@ private function after()
111111

112112
/**
113113
* @param string $dotProperty
114-
*
114+
* @param string|null $joinType
115115
* @return string
116116
* @throws UseQueryFromDotNotationException
117117
*/
118-
private function before(string $dotProperty)
118+
private function before(string $dotProperty, string $joinType = null)
119119
{
120120

121121
$dotProperty = trim($dotProperty, UseQueryFromDotNotation::RELATION_SEP);
122122
$parts = explode(UseQueryFromDotNotation::RELATION_SEP, $dotProperty);
123123
$property = ucfirst(array_pop($parts));
124124

125125
$this->dotUseQuery = new UseQueryFromDotNotation($this->query);
126-
$this->query = $this->dotUseQuery->fromArray($parts)->useQuery();
126+
$this->query = $this->dotUseQuery->fromArray($parts)->useQuery(null, $joinType);
127127

128128
return $property;
129129
}

0 commit comments

Comments
 (0)