php - Doctrine2 querystring query -


Currently I am developing a relaxing-ap-app with symphony 2 and theory 2. My APIs have the functionality to filter results by a quickstring. For example, the following URL: http://example.com/api/users?orderBy=username%20DESC&limit=20

I query string to Parse_str ($ This- & gt; getRequest () - & gt; getQueryString (), $ queryString); Is there an assignment for an assoc array that I can commit to the array and the theory selects this result? Something like $ users = $ this- & gt; GetDoctrine () - & gt; GetRepository ('UserBundle: User') - & gt; FindByQueryString ($ queryString); Like AdrienBrault has said that the use of parse_str can not be used by the

Keep it in your controller instead:

  $ order by = $ this- & gt; Receive ('request') - & gt; Query-> Receive ('Order By'); $ Limit = $ this- & gt; Receive ('request') - & gt; Query-> Get ('border'); $ Rep = $ this- & gt; GetDoctrine () - & gt; GetRepository ('UserBondal: User'); $ User = $ rep- & gt; FindLimit Order Bye ($ Order By, $ Border);   

and within its user storage class:

  public function findLimitOrderBy ($ orderBy, $ limit) {$ query = $ this- & gt; GetEntityManager () - & gt; Choose from YouTubeBundle (UserU order from userbundle). $ Order buy) - & gt; Setx results ($ border); Return $ query- & gt; GetResult (); }    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -