php - Symfony2 notIn doesn't work -


I'm trying to do with a section that does not use a query_builder. But this does not work and I have this error message:

  C: \ wamp \ www \ projet \ src \ intranet in a non-member member function expr () UserBundle \ unit \ UserRepository.php Line 301   

This is the method:

  Public function employesSansCongesAllouesEn ($ Annee) {$ denies = $ this- & gt; CreateQueryBuilder ('U') // rà © Cupa © RER Les Emplo © © que ont da © ja des Kanga © Daniel Dosha - & gt; Selection ('u.id') - & gt; (Join '\ Intranet \ CalendrierBundle \ Unit \ UserCongeByYear', 'UC', "with", "uc.user = u.id") // Stirring UserCongeByYear - & gt; AndWhere ('u.enabled = 1') - & gt; AndWhere ('UC. Ani =: Anne') // Status D NAC E - & gt; GetDQL (); $ QB = $ this- & gt; CreateQueryBuilder ('Users') // rà © Cupa © RER Les Emplia © chi n'ont step repeat de kanga © pour l'anna © e choisie - & gt; AndWhere ('user.enabled = 1') - & gt; Separate ('user') - & gt; And where ($ qb-> expr () - & gt; not ('user.id', $ nots)) // is not the status - Set Parameter (': Anne', $ ANEI) - & gt; Order bye ('usernames', 'asc'); $ Qb return; }   

and use this query in the form:

  public function buildForm (FormBuilderInterface $ Builder, array $ option) {$ Builder - & gt; Adding ('those', 'unit', array ('label' = & gt; "Employà © s:", 'class' =>' IntranetUserBundle: user ',' multiple '= & gt; false,' required '= & Gt; true,' attr '=> array (' class' => form control), 'query_builder' => employesSansCongesAllouesEn ($ option;; (UserRepository $ er) ( $ Option) use {$ ER & gt Return 'Annee']);})) - & gt; "Nobre de Heures attribuà © es:"; To add 'Heures',' Integer ', array (' label '= & gt;' attr '= & gt; array (' square '= & gt; form-control', 'min' = & gt; 1, 'max' = & gt; '250'))); }    

using $ qb Has been declared earlier.

You should declare it and then it should be used later in the query building process, like.

  $ qb = $ this-> createQueryBuilder (); // rà © Cupa © RER Les Emplia © is qui ont da © ja des Kanga © ita $ denies = $ QB - & gt; Selection ('u.id') - & gt; (Join '\ Intranet \ CalendrierBundle \ Unit \ UserCongeByYear', 'UC', "with", "uc.user = u.id") // Stirring UserCongeByYear - & gt; AndWhere ('u.enabled = 1') - & gt; AndWhere ('uc.annee =: Annie') // Status D NAC EE - & gt; GetDQL (); // rà © Cupa © RER Les Emplia © © qui n'ont step repeat de kanga © lenna © e choisie return $ QB pour - & gt; Where ('user.enabled = 1') - & gt; Specific ('user') - & gt; AndWhere ($ qb-> ex - (-); Notin ('user.id', $ deprived)) // Not in condition - & gt; SetParameter (': Annee', $ Annee) - & gt; Commandbiz ('user.nom', 'asc');    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -