private function createServiceHal(Service $service)
 {
     $normalizer = $this->normalizer();
     $hal = (new Hal('/services/' . $service->getId()))->setData($this->getData($service));
     foreach ($service->getProviders() as $provider) {
         $hal->addResource('providers', (new Hal('/providers/' . $provider->getId()))->setData($normalizer->normalize($provider)));
     }
     foreach ($service->getStages() as $stage) {
         $hal->addResource('stages', (new Hal('/stages/' . $stage->getId()))->setData($normalizer->normalize($stage)));
     }
     foreach ($service->getCategories() as $category) {
         $hal->addResource('categories', (new Hal('/categories/' . $category->getId()))->setData($normalizer->normalize($category)));
     }
     foreach ($service->getServiceUsers() as $serviceUser) {
         $hal->addResource('serviceUsers', (new Hal('/service-users/' . $serviceUser->getId()))->setData($normalizer->normalize($serviceUser)));
     }
     foreach ($service->getIssues() as $issue) {
         $hal->addResource('issues', (new Hal('/issues/' . $issue->getId()))->setData($normalizer->normalize($issue)));
     }
     return $hal;
 }
Exemplo n.º 2
0
 /**
  * Creates a form to delete a Service entity by id.
  *
  * @param Service $service
  *
  * @return \Symfony\Component\Form\Form
  */
 private function createDeleteForm(Service $service)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('service_delete', array('id' => $service->getId())))->setMethod('DELETE')->getForm();
 }