Doubt of Symfony2.16

Asked

Viewed 6 times

1

I am working with symfony2.16 I intend to select the person if this is not a foreign key in the user table my code is like this: public Function buildForm(Formbuilderinterface $Builder, array $options) {

    $idPessoa =  $options['idPessoa'];

    $builder
        ->add('idPessoa', 'entity', array('class' => 'SUGASugaBundle:Pessoa',
            'query_builder' => function(EntityRepository $er)  use ($idPessoa){

                return $er->createQueryBuilder('a')
                    ->join('SUGASugaBundle:User','u')
                    ->where('a.id != u.idPessoa')
                    ->andwhere('a.id != :id')
                    ->setParameter('id', $idPessoa)
                    ->orderBy('a.nome');
            },
            'choice_label' => 'getNomeCompleto'
        ))
        ->remove('plainPassword')
        ->remove('username')
        ->add('save', 'submit', array('label' =>'Salvar'));
    ;

so it is to bring who already has user account

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.