File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 3
3
All notable changes to this project will be documented in this file. This project adheres to
4
4
[ Semantic Versioning] ( http://semver.org/ ) and [ this changelog format] ( http://keepachangelog.com/ ) .
5
5
6
+ ## [ 3.0.1] - 2023-04-03
7
+
8
+ ### Fixed
9
+
10
+ - [ #29 ] ( https://github.com/laravel-json-api/eloquent/pull/29 ) Avoid unnecessary query when there is no need to count a
11
+ relationship.
12
+
6
13
## [ 3.0.0] - 2023-02-14
7
14
8
15
### Changed
Original file line number Diff line number Diff line change @@ -123,12 +123,12 @@ public function loadMissing($includePaths): self
123
123
*/
124
124
public function loadCount ($ countable ): self
125
125
{
126
- $ counter = new CountableLoader (
127
- $ this ->schema ,
128
- CountablePaths::cast ($ countable )
129
- );
126
+ $ paths = CountablePaths::cast ($ countable );
130
127
131
- $ this ->target ->loadCount ($ counter ->getRelations ());
128
+ if ($ paths ->isNotEmpty ()) {
129
+ $ counter = new CountableLoader ($ this ->schema , $ paths );
130
+ $ this ->target ->loadCount ($ counter ->getRelations ());
131
+ }
132
132
133
133
return $ this ;
134
134
}
You can’t perform that action at this time.
0 commit comments