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: I query string to Keep it in your controller instead: and within its user storage class: http://example.com/api/users?orderBy=username%20DESC&limit=20
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
$ 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);
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
Post a Comment