Exemplo n.º 1
0
 protected function getFormData(ManagedRepositoryInterface $repository, Request $request)
 {
     if (!($id = $request->get('id'))) {
         throw new HttpException(404, 'No ID was specified.');
     }
     if (!($entity = $repository->find($id))) {
         $humanName = $repository->queryMetadata('getEntityHumanName');
         $message = sprintf('No %s exists with ID %d.', $humanName, $id);
         throw new HttpException(404, $message);
     }
     $formData = new \stdClass();
     $formData->entity = $entity;
     return $formData;
 }