-1

I like to run : php sendnotifications.php (path : C:\wamp64\bin\php\php5.6.25\php.exe sendnotifications.php) from a symfony function

public function reserverHebAction(Request $request,$idHebergement)
{
    $em = $this->getDoctrine()->getManager();
    $ReservationHebergement = new ReservationHebergement();
    $form = $this->createForm(ReserverType::class, $ReservationHebergement);


    $hebergement=$em->getRepository('govoyagereverseBundle:Hebergement')
        ->find($idHebergement);

    if ($form->handleRequest($request)->isValid() ){
        $hebergement->setDisponibilite($hebergement->getDisponibilite() ==0);
        $user = $this->container->get('security.token_storage')->getToken()->getUser();
        $em = $this->getDoctrine()->getManager();
        $em->persist($hebergement);//insert into model
        $em->flush();//execution de la requete

        $ReservationHebergement->setNomUtilisateurH($user);
        $ReservationHebergement->setIdhebergement($idHebergement);

        $em->persist($ReservationHebergement);
        $em->flush();
        //************sms-***************************************
        /**********I I NEED TO EXCUTE IT HERE **************
        //*******sms-*****************************

        return $this->redirectToRoute('rechercheHeb');
    }
    return $this->render(
        '@govoyagegestionHebergementAdmin/hebergement/reserverHeb.html.twig',
        array('f2' => $form->createView())
    );
}
Fruchtzwerg
  • 10,999
  • 12
  • 40
  • 49

1 Answers1

0

You should be able to use the exec or shell_exec methods to do what you're specifically asking (here's an answer discussing the difference) but I would suggest importing whatever function you need and running it.

csilk
  • 2,732
  • 3
  • 23
  • 40