0

I want to get data from my database table "Client",but I get this result:

`[{},{},{}]`

this is my code:

 <?php
            namespace OP\OPBundle\Controller;
            use Symfony\Bundle\FrameworkBundle\Controller\Controller;
            use OP\OPBundle\Entity\Client;
            class ClientAPIController extends Controller
            {
                public function indexAction()
                {

                    $em = $this->getDoctrine()->getManager();
                   $personne = $em->getRepository('OPOPBundle:Client')->findAll();
            //    $personne_tab=array();
            //    $personne_tab['nom']=$personne->getNom();
            //    $personne_tab['prenom']=$personne->getPrenom();
            //   $personne_tab['id']=$personne->getId();
                $personntojson=  json_encode($personne);
                    return $this->render('OPOPBundle:ClientAPI:index.html.twig', array(
                            'reponse'=> $personntojson
                        ));    

}

this is index.html.twig:

` {{reponse}}`

thanks for Help

2
Contributors
1
Reply
5
Views
2 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.