Closed as not planned
Description
Hello,
It's still a bit vague in my mind, But I always face the same issue,
and I did not found a way to code it.
I have a resource name Crawl
(stored and Doctrine, but exposed via a custom DTO + security) and some subresource named CrawlUrl
(stored in ClickHouse, but exposed via a custom DTO + security)
I have the following endpoint
/crawls/{id}
/crawls/{crawlId}/crawl-urls/{id}
In my CrawlUrlItemProvider (for examples) I would like to be able to write such code
public function provide(Operation $operation, array $uriVariables = [], array $context = []): ?CrawlUrl
{
$crawl = $this->crawlProvider->provide($operation, ['id' => $uriVariables['crawlId']], $context);
// here, $crawl is either an instance of my CrawlDto, and security has passed,
// or null in case the object was not found in the DB.
Did I miss something, or is it something out of scope? If no, could this be implemented in APIP?
I imagine something like:
#[ApiResource(
operations: [
new Get(
uriTemplate: '/crawls/{crawlId}/crawl-urls/{id}',
requirements: [
'id' => Requirement::UUID,
'crawlUrlId' => Requirement::UUID,
],
// ⚠⚠⚠⚠ this is probably bullshit, I don't understand the from/to thing ⚠⚠⚠⚠
uriVariables: [
'crawlId' => new Link(
fromClass: Crawl::class,
parameterName: 'id',
identifiers: ['id'],
),
'id' => new Link(
toClass: CrawlUrl::class,
),
],
),
],
)]
class CrawlUrl
may be linked to #7105
Metadata
Metadata
Assignees
Labels
No labels