0

i have done a function in repository file

public function FindAllPersonalsOfSupervisor($parameter) {
    return $this
        ->createQueryBuilder('u')
        ->where('u.parent = :id')
        ->setParameter('id', $parameter)
        ->getQuery()
        ->getResult()

    ;
}

it works fine and in the controller when i do the dump($listPersonals) i have my result very well and what i want but when i do the render function i have this error :

Variable "listPersonals" does not exist in HRBundle:personalmanagementinfo:personal_list.html.twig at line 50

    public function indexAction() {

    //récupération du repository
    $repository = $this
            ->getDoctrine()
            ->getManager()
            ->getRepository('AuthenticationBundle:User')
    ;
    $user = $this->getUser();

    // On récupère la liste des personnels de l'utilisateur authentifié
    $listPersonals = $repository->FindAllPersonalsOfSupervisor($user);
    //dump($listPersonals);
    //die();
    return $this->render('HRBundle:personalmanagementinfo:personal_list.html.twig', array(
                'user' => $user,
                'listPersonals', $listPersonals
    ));
}

my twig is :

{% for listPersonal in listPersonals %}
   <tr>
       <td>{{ listPersonal.lastname }} {{ listPersonal.firstname }}</td>
       <td>{{ listPersonal.email }}</td>
       <td>{{ listPersonal.telephone }}</td>
       <td></td>
       </tr>
 {% endfor %}

i don't see the problem plz help me

1 Answer 1

1

in your controller, when you return your variables it should be:

'listPersonals'=>$listPersonals
Sign up to request clarification or add additional context in comments.

3 Comments

hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh what i'm doing hhhhhhhhhhhhhhhhhhhhhhhhhhh ooohhhhhhhhh i have two days here hhhhhhhhhhhhhhhhh rabi ybareklek khouya abdelaziz
Exactly. Sometimes, it takes only a pair of eyes to solve a problem. Accept my answer please.
w men ghir mziya hhhhh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.