Skip to content

Commit b4bcc97

Browse files
committed
Merge branch 'develop'
2 parents ab6a8b8 + 6f243ff commit b4bcc97

File tree

5 files changed

+70
-10
lines changed

5 files changed

+70
-10
lines changed

src/Drivers/EloquentEntitySet.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,6 @@ public function query(): array
195195
}
196196

197197
$this->resetParameters();
198-
199-
$select = $this->transaction->getSelect();
200-
if ($select->hasValue()) {
201-
$properties = $select->getSelectedProperties($this)->sliceByClass(DeclaredProperty::class);
202-
/** @var DeclaredProperty $property */
203-
foreach ($properties as $property) {
204-
$builder->addSelect($property->getName());
205-
}
206-
}
207-
208198
$this->generateWhere();
209199

210200
if ($this->where) {

tests/Unit/Eloquent/EloquentTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,4 +510,16 @@ public function test_compound_filter()
510510
->filter("startswith(code, 'l') and is_big eq true")
511511
);
512512
}
513+
514+
public function test_read_with_select_and_metadata()
515+
{
516+
$this->withFlightData();
517+
518+
$this->assertJsonResponse(
519+
Request::factory()
520+
->path('/Flights')
521+
->metadata(Metadata\Full::name)
522+
->query('$select', 'destination')
523+
);
524+
}
513525
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"@context": "http://localhost/odata/$metadata#Flights(destination)",
3+
"@readLink": "http://localhost/odata/Flights",
4+
"value": [
5+
{
6+
"@type": "#com.example.odata.Flight",
7+
"@id": "http://localhost/odata/Flights(1)",
8+
"@readLink": "http://localhost/odata/Flights(1)",
9+
"destination": "lax"
10+
},
11+
{
12+
"@type": "#com.example.odata.Flight",
13+
"@id": "http://localhost/odata/Flights(2)",
14+
"@readLink": "http://localhost/odata/Flights(2)",
15+
"destination": "rgr"
16+
},
17+
{
18+
"@type": "#com.example.odata.Flight",
19+
"@id": "http://localhost/odata/Flights(3)",
20+
"@readLink": "http://localhost/odata/Flights(3)",
21+
"destination": "lax"
22+
}
23+
]
24+
}

tests/Unit/Queries/EntitySet/EntitySetTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,14 @@ public function test_read_an_entity_with_no_metadata()
3939
->path('/flights')
4040
);
4141
}
42+
43+
public function test_read_with_select_and_metadata()
44+
{
45+
$this->assertJsonResponse(
46+
Request::factory()
47+
->path('/flights')
48+
->metadata(Metadata\Full::name)
49+
->query('$select', 'destination')
50+
);
51+
}
4252
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"@context": "http://localhost/odata/$metadata#flights(destination)",
3+
"@readLink": "http://localhost/odata/flights",
4+
"value": [
5+
{
6+
"@type": "#com.example.odata.flight",
7+
"@id": "http://localhost/odata/flights(1)",
8+
"@readLink": "http://localhost/odata/flights(1)",
9+
"destination": "lax"
10+
},
11+
{
12+
"@type": "#com.example.odata.flight",
13+
"@id": "http://localhost/odata/flights(2)",
14+
"@readLink": "http://localhost/odata/flights(2)",
15+
"destination": "rgr"
16+
},
17+
{
18+
"@type": "#com.example.odata.flight",
19+
"@id": "http://localhost/odata/flights(3)",
20+
"@readLink": "http://localhost/odata/flights(3)",
21+
"destination": "lax"
22+
}
23+
]
24+
}

0 commit comments

Comments
 (0)