return $child['definition'
];
} private function write(Request
$request, Context
$context, ResponseFactoryInterface
$responseFactory, string
$entityName, string
$path, string
$type): Response
{ $payload =
$this->
getRequestBody($request);
$noContent = !
$request->query->
has('_response'
);
// safari bug prevents us from using the location header
$appendLocationHeader = false;
if ($this->
isCollection($payload)) { throw ApiException::
badRequest('Only single write operations are supported. Please send the entities one by one or use the /sync api endpoint.'
);
} $pathSegments =
$this->
buildEntityPath($entityName,
$path,
$context,
[WriteProtection::
class]);
$last =
$pathSegments[\
count($pathSegments) - 1
];
if ($type === self::WRITE_CREATE && !
empty($last['value'
])) { $methods =
['GET', 'PATCH', 'DELETE'
];
throw ApiException::
methodNotAllowed($methods,
sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)',
$request->
getMethod(),
$request->
getPathInfo(),
implode(', ',
$methods)));
}