Consider the BlogPost

class BlogPost implements AuthoredEntityInterface, PublishedDateEntityInterface
{
/**
 *@ORM\\Id
 *@ORM\\GeneratedValue
 *@ORM\\Column(type="integer")
 */
private $id;

/**
 *@ORM\\Column(type="string", length=255)
 *@Assert\\Length(min=10)
 *@Groups({"post"})
 */
private $title;

/**
 *@ORM\\Column(type="datetime")
 */
private $published;

/**
 *@ORM\\Column(type="text")
 *@Assert\\NotBlank()
 *@Assert\\Length(min=20)
 *@Groups({"post"})
 */
private $content;

/**
 *@ORM\\ManyToOne(targetEntity="App\\Entity\\User")
 *@ORM\\JoinColumn(nullable=false)
 */
private $author;

/**
 *@ORM\\Column(type="string", length=255)
 *@Assert\\NotBlank()
 *@Groups({"post"})
 */
private $slug;

/**
 *@ORM\\OneToMany(targetEntity="App\\Entity\\Comment", mappedBy="blogPost")
 */
private Collection $comments;

...

When queried with ApiPlaftorm we will get something like this:

http://localhost:8080/api/blog_posts/583

{
	"@context": "\\/api\\/contexts\\/BlogPost",
	"@id": "\\/api\\/blog_posts\\/583",
	"@type": "BlogPost",
	"id": 583,
	"title": "Rabbit began. Alice thought.",
	"published": "2021-12-09T23:20:46+00:00",
	"content": "Mock Turtle would be grand, certainly,' said Alice, looking down at her for a dunce? Go on!' 'I'm a poor man, your Majesty,' the Hatter hurriedly left the court, without even waiting to put it.",
	"author": "\\/api\\/users\\/22",
	"slug": "nostrum-minus-aut-harum-autem-voluptas",
	"comments": [
		"\\/api\\/comments\\/764",
		"\\/api\\/comments\\/765",
		"\\/api\\/comments\\/766",
		"\\/api\\/comments\\/767",
		"\\/api\\/comments\\/768",
		"\\/api\\/comments\\/769",
		"\\/api\\/comments\\/770",
		"\\/api\\/comments\\/771"
	]
}

With this approach we are seeing the comment uris, but we have no way of getting all the comments for this BlogPost without getting them one by one.

To accomplish that we have the @ApiSubresource annotation:

class BlogPost implements AuthoredEntityInterface, PublishedDateEntityInterface
{

...

/**
 *@ORM\\OneToMany(targetEntity="App\\Entity\\Comment", mappedBy="blogPost")
 * @ApiSubresource()
 */
private Collection $comments;

...

We now have the following route:

https://localhost:8080/api/blog_posts/583/comments

{
	"@context": "\\/api\\/contexts\\/Comment",
	"@id": "\\/api\\/blog_posts\\/583\\/comments",
	"@type": "hydra:Collection",
	"hydra:member": [
		{
			"@id": "\\/api\\/comments\\/764",
			"@type": "Comment",
			"id": 764,
			"content": "Do you think, at your age, it is I hate cats and dogs.' It was the Cat in a solemn tone, 'For the Duchess. An invitation from the roof. There were doors all round her, about the whiting!' 'Oh, as to.",
			"published": "2021-10-18T20:12:08+00:00",
			"author": "\\/api\\/users\\/22",
			"blogPost": "\\/api\\/blog_posts\\/583"
		},
		{
			"@id": "\\/api\\/comments\\/765",
			"@type": "Comment",
			"id": 765,
			"content": "Alice. 'I don't know the meaning of it had finished this short speech, they all moved off, and she very soon had to be executed for having missed their turns, and she went on, half to Alice. 'What.",
			"published": "2021-10-11T20:39:00+00:00",
			"author": "\\/api\\/users\\/22",
			"blogPost": "\\/api\\/blog_posts\\/583"
		},
		{
			"@id": "\\/api\\/comments\\/766",
			"@type": "Comment",
			"id": 766,
			"content": "Alice heard the King said to herself, for she felt certain it must be collected at once took up the little passage: and THEN--she found herself lying on the trumpet, and then Alice put down yet.",
			"published": "2021-07-25T16:48:45+00:00",
			"author": "\\/api\\/users\\/21",
			"blogPost": "\\/api\\/blog_posts\\/583"
		},
		{
			"@id": "\\/api\\/comments\\/767",
			"@type": "Comment",
			"id": 767,
			"content": "Dormouse, after thinking a minute or two, and the cool fountains. CHAPTER VIII. The Queen's argument was, that you couldn't cut off a bit of the other side of the deepest contempt. 'I've seen a good.",
			"published": "2021-08-19T05:12:46+00:00",
			"author": "\\/api\\/users\\/22",
			"blogPost": "\\/api\\/blog_posts\\/583"
		},
		{
			"@id": "\\/api\\/comments\\/768",
			"@type": "Comment",
			"id": 768,
			"content": "So she went on for some time in silence: at last came a little sharp bark just over her head pressing against the door, she walked off, leaving Alice alone with the lobsters to the table to measure.",
			"published": "2021-07-16T09:12:05+00:00",
			"author": "\\/api\\/users\\/23",
			"blogPost": "\\/api\\/blog_posts\\/583"
		},
		{
			"@id": "\\/api\\/comments\\/769",
			"@type": "Comment",
			"id": 769,
			"content": "Crab, a little quicker. 'What a number of executions the Queen had never forgotten that, if you wouldn't keep appearing and vanishing so suddenly: you make one repeat lessons!' thought Alice; 'I.",
			"published": "2021-12-20T20:29:51+00:00",
			"author": "\\/api\\/users\\/21",
			"blogPost": "\\/api\\/blog_posts\\/583"
		},
		{
			"@id": "\\/api\\/comments\\/770",
			"@type": "Comment",
			"id": 770,
			"content": "Alice heard it muttering to himself in an impatient tone: 'explanations take such a fall as this, I shall fall right THROUGH the earth! How funny it'll seem to put it to her ear. 'You're thinking.",
			"published": "2021-12-27T07:13:00+00:00",
			"author": "\\/api\\/users\\/21",
			"blogPost": "\\/api\\/blog_posts\\/583"
		},
		{
			"@id": "\\/api\\/comments\\/771",
			"@type": "Comment",
			"id": 771,
			"content": "The Caterpillar was the same age as herself, to see if she meant to take the place of the miserable Mock Turtle. 'Very much indeed,' said Alice. 'Why, there they lay on the breeze that followed.",
			"published": "2021-05-23T11:10:30+00:00",
			"author": "\\/api\\/users\\/24",
			"blogPost": "\\/api\\/blog_posts\\/583"
		}
	],
	"hydra:totalItems": 8
}