mysql - Using doctrine instead of sql -
I have to follow the function in my symphony-web-controller:
Search Responsive Department ($ Suche) {$ principle = $ this- & gt; GetDoctrine (); $ Em = $ principle- & gt; GetManager (); $ ArrTerm = Explosion ("", $ suche); ($ I = 0; $ i & lt; counts ($ arrTerm); $ i ++) {$ arrWhere [] = "GSPL $ $ erert [$ i]" '' ; // $ arrParameter [] = "\" value " $ I. "\" = & gt; \ "%". $ ArrTerm [$ i]. "% \" ";} $ Where = wrapper ($ arrWhere," OR "); // $ param = implode ($ arrParameter,", "); $ query = $ em- & gt; ; CreateQuery ('Select nl.email from MbsNiederlassungBundle: GebietStadt gs INNER JOIN MbsNiederlassungBundle: Niederlassung nl nl nl.id = gs.idNiederlassung WHERE'. $ Where); $ result = $ query- & gt; getResult (); if ( Calculation ($ result) & gt; 0) {$ email = $ result [0] ["email"]; $ email return;} other {return false;}} I I want to use theory-statement I
Do I have to change the query for theory?
Should I make a custom repository? < /p>
you
$ qb = $ em-> createQueryBuilder ( ) - & gt; Select & quot; MBSNEdlersSundung Bundle: Gbieststad ',' GS ') - & gt; InnerJoin (' MBSNEEDERS BULLDEL: NETHERLANDS ',' NL ',' WEED ',' ($ I = 0; $ i & lt; counts ($ arrTerm); $ i ++); {$ ph = 'plz' $ I; for 'NL.ID = GIIDAlanSource'); $ Qb- & gt; Or where ('like gs.plz'. $ Ph); $ Qb- & gt; Set schemator ($ ph, $ arrTerm [$ i]); }
Comments
Post a Comment