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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.