Closed
Description
Context
class Person {
#[LodataRelationship]
public function link()
{
return $this->hasOne(Link::class, 'id', 'link_id' );
}
#[LodataRelationship]
public function tags(){
return $this->hasMany(Tag::class);
}
}
class Tag {
}
class Link {
#[LodataRelationship]
public function sublink()
{
return $this->hasOne(SubLink::class, 'id', 'sublink_id' );
}
}
class Sublink {
}
Db
Table person{id, link_id}
Table tags{id}
Table link{id}
Table sublink{id}
Table person_tag{person_id,tag_id}
Request
http://localhost:8080/odata/Person?expand=link($expand=sublink)
Result
The result is the same with this request http://localhost:8080/odata/Person?expand=link
the nested $expand is not used.
{
{
"@context": "http://localhost:8080/odata/$metadata#Gparent01s(link())",
"value": [
{
"id": 1,
"glink01_fk": 1,
"cproperty01": "sed earum repellendus enim mollitia sit odit incidunt numquam a",
"nproperty02": 318,
"bproperty03": false,
"dproperty04": "1988-04-24T01:47:09+00:00",
"created_at": "2022-05-03T12:46:19+00:00",
"updated_at": "2022-05-03T12:46:19+00:00",
"link": {
"id": 1,
"sublink_id": 1,
"link": "quis eum autem laboriosam qui cupiditate quod mollitia nihil repellendus",
"values": "voluptas sed explicabo a at cum repellat sed repellendus eos",
"created_at": "2022-05-03T12:46:19+00:00",
"updated_at": "2022-05-03T12:46:19+00:00"
}
}
}
Expected result
The result should contains the Sublink entity when present in the relationship as expected (with the correct context) : https://docs.oasis-open.org/odata/odata/v4.01/os/part1-protocol/odata-v4.01-os-part1-protocol.html#sec_ExpandOptions
{
{
"@context": "http://localhost:8080/odata/$metadata#Gparent01s(link(Sublink()))"
"value": [
{
"id": 1,
"glink01_fk": 1,
"cproperty01": "sed earum repellendus enim mollitia sit odit incidunt numquam a",
"nproperty02": 318,
"bproperty03": false,
"dproperty04": "1988-04-24T01:47:09+00:00",
"created_at": "2022-05-03T12:46:19+00:00",
"updated_at": "2022-05-03T12:46:19+00:00",
"link": {
"id": 1,
"sublink_id": 1,
"link": "quis eum autem laboriosam qui cupiditate quod mollitia nihil repellendus",
"values": "voluptas sed explicabo a at cum repellat sed repellendus eos",
"created_at": "2022-05-03T12:46:19+00:00",
"updated_at": "2022-05-03T12:46:19+00:00",
"sublink" : {
"id": 1,
"sublink": "quis eum autem laboriosam qui cupiditate quod mollitia nihil repellendus".
"prop1": 1231,
"created_at": "2022-05-20T14:47:24+00:00",
"updated_at": "2022-05-20T15:47:24+00:00",
}
}
}
}
Version
"flat3/lodata": "^5.11"
Metadata
Metadata
Assignees
Labels
No labels