Tuesday 15 June 2010

symfony 1.4 - Propel multiple-parameter binding in where() clause -


I'm trying to run this question with 1.6 Symphony 1.4.20.

I want to force 2 parameters on this subquery, but it is not working.

  $ pages = PaginaQuery :: create () - & gt; Where (choose the "clienti_artista Cliente_id =? And cliente_artista.culture =?)", (Array '(' XXX ',' n ')) -> in pagina.id (select "clienti_artista"); Range (5) - & gt; Search ();   

This gives me an error:

  can not determine the column to bind the parameters in the section   

I also found this post but there is no answer ()

instead of using placeholder You can use the $ ID and $ culture:

  // First, get an array of IDs // Define your wars $ id = $ your_id_param; $ Culture = 'n'; $ Cliente_artistas = ClienteArtistaQuery :: create () - & gt; Select ('id') - & gt; Different () - & gt; FilterB-Client id ($ id) - & gt; FilterBeculture ($ culture) - & gt; Search (); $ Paginas = PaginaQuery :: create () - & gt; Where ("Page No. What?", $ Cliente_artistas) - & gt; Range (5) - & gt; Search ();   

If this is to be done in a query, then recommend using the raw SQL in the PDO statement and binding the parameter (but then you lose the chance of PropelObjectCollections):

  public function getResultSet ($ id, $ culture) {$ id = $ id_param; $ Culture = $ culture_param; $ Sql ​​= & amp; Lt; & Lt; & Lt; ENDSQL SELECT * is not on page WHERE ID (Select different ID from client WHERE cliente_id =? And culture =?) LIMIT 5 ENDSQL; $ Connection = Propell :: Mill Connection (); $ Statement = $ connection-> Prepare ($ sql); $ Statement- & gt; Bind value (1, $ id); $ Statement- & gt; Bind value (2, $ culture); $ Statement & gt; Executed (); $ Resultset = $ statement- & gt; Get All (PDO :: FETCH_ASSOC); // Or whatever you need (count! ($ Resultset)> = 1) {// Brace the empty resultset} returnities $ returnet; }   

You can also type some query methods to use. Of course, this is a beneficial reference. There are several ways to do this. I have indicated a method here that should work for you.

Edit: There is an idea to do this as a query [Because the utility usage () requires the name 'relationship'), it considers the idea The tables are not related but these are the IDs:

  $ page = PageGrange :: :: () -> addJoin (Pagesieri :: ID, Client Ersteopsy :: CLIENTE_ID, criteria :: LEFT_JOIN) - & gt; Where ("Clint Artist.ID <", $ Id) - & gt; Where ("Clint Artist.Silkat <<", $ culture) - & gt; Select (Arrays ('Your', 'Page', 'Column', 'Array')) - & gt; Range (5) - & gt; Search ();    

No comments:

Post a Comment