/** @var string $id id is always set, otherwise the route would not match */
$id =
$last['value'
];
/** @var EntityPathSegment $first */
$first =
array_shift($pathSegments);
if (\
count($pathSegments) === 0
) { // first api level call /product/{id}
$definition =
$first['definition'
];
$this->
executeWriteOperation($definition,
['id' =>
$id],
$context, self::WRITE_DELETE
);
return $responseFactory->
createRedirectResponse($definition,
$id,
$request,
$context);
} $child =
array_pop($pathSegments);
$parent =
$first;
if (!
empty($pathSegments)) { $parent =
array_pop($pathSegments);
} $definition =
$child['definition'
];