original_string: public function setBillingAddressAction($id)
      {
          $em = $this->container->get('doctrine')->getManager();
          $user = $this->container->get('security.token_storage')->getToken()->getUser();
          $address = $em->getRepository('EcommerceBundle:Address')
              ->findOneBy(array(
                      'id'   => $id,
                      'actor' => $user,
                  ));
          if (is_null($address)) {
              throw new AccessDeniedException();
          }
  
          $em->getRepository('EcommerceBundle:Address')->removeForBillingToAllAddresses($user->getId());
  
          $address->setForBilling(1);
  //        $em->persist($address);
          $em->flush();
  
          $url = $this->container->get('router')->generate('core_actor_profile').'?delivery=1';
  
          $this->container->get('session')->getFlashBag()->add('success', 'account.address.assigned.for.billing');
  
          return new RedirectResponse($url);
      }
code: public function setBillingAddressAction($id)
      {
          $em = $this->container->get('doctrine')->getManager();
          $user = $this->container->get('security.token_storage')->getToken()->getUser();
          $address = $em->getRepository('EcommerceBundle:Address')
              ->findOneBy(array(
                      'id'   => $id,
                      'actor' => $user,
                  ));
          if (is_null($address)) {
              throw new AccessDeniedException();
          }
  
          $em->getRepository('EcommerceBundle:Address')->removeForBillingToAllAddresses($user->getId());
  
          $address->setForBilling(1);
  //        $em->persist($address);
          $em->flush();
  
          $url = $this->container->get('router')->generate('core_actor_profile').'?delivery=1';
  
          $this->container->get('session')->getFlashBag()->add('success', 'account.address.assigned.for.billing');
  
          return new RedirectResponse($url);
      }
code_tokens: public function setBillingAddressAction ( $ id ) { $ em = $ this -> container -> get ( 'doctrine' ) -> getManager ( ) ; $ user = $ this -> container -> get ( 'security.token_storage' ) -> getToken ( ) -> getUser ( ) ; $ address = $ em -> getRepository ( 'EcommerceBundle:Address' ) -> findOneBy ( array ( 'id' => $ id , 'actor' => $ user , ) ) ; if ( is_null ( $ address ) ) { throw new AccessDeniedException ( ) ; } $ em -> getRepository ( 'EcommerceBundle:Address' ) -> removeForBillingToAllAddresses ( $ user -> getId ( ) ) ; $ address -> setForBilling ( 1 ) ; //        $em->persist($address); $ em -> flush ( ) ; $ url = $ this -> container -> get ( 'router' ) -> generate ( 'core_actor_profile' ) . '?delivery=1' ; $ this -> container -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'account.address.assigned.for.billing' ) ; return new RedirectResponse ( $ url ) ; }
docstring: Set the address as the billing address
  
  @param integer $id
  
  @throws AccessDeniedException
  @return RedirectResponse
  
  @Route("/profile/delivery/{id}/set-for-billing")
  @Method("GET")
  @Template("EcommerceBundle:Profile:Delivery/show.html.twig")
docstring_tokens: Set the address as the billing address