Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Find('list'), dois campos e order não funciona?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Celso  
View profile   Translate to Translated (View Original)
 More options Nov 10, 12:48 pm
From: Celso <cels...@gmail.com>
Date: Tue, 10 Nov 2009 09:48:24 -0800 (PST)
Local: Tues, Nov 10 2009 12:48 pm
Subject: Find('list'), dois campos e order não funciona?
  $proprietarios = $this->Multa->Veiculo->Proprietario->find('list',
                          array(
                                'order' => 'nome',
                                'fields' => 'nome' ));
****resultado:

Array
(
    [57] =>
    [19] => -
    [15] => -
    [27] => aaaa!
    [26] => aaaaaaaa
    [25] => aaaaaaaa
    [51] => bla
    [16] => celso
    [17] => celso
    [9] => Celso
    [46] => Frederico
    [3] => Gabriel
    [45] => Gloria7777
    [55] => paulo
    [70] => qqqqqqqqqqqqqqqqqq
    [7] => Rafael
    [44] => Rita
    [56] => Rita
    [63] => Rita
    [61] => Rita
    [5] => Rita P
    [65] => RitaRita
    [67] => RitaRita
    [66] => RitaRita
    [18] => rufino
    [48] => teste
    [59] => Teste
    [58] => Teste
    [42] => teste
    [10] => Testolino da Silva
    [60] => tiago
    [62] => tiago
    [6] => Tiago Imazio
    [36] => tom, o gato
    [13] => Ultimos ultimatos
    [1] => Usla
    [69] => uuuuuuuuuuuuuuuuuu
    [71] => Velinho da Silva
    [68] => wefwerwedwerwe
    [43] => Zé Ramalho
)

                $proprietarios = $this->Multa->Veiculo->Proprietario-

>find('list',

                          array(
                                'order' => 'nome',
                                'fields' => 'email,nome' ));

****resultado:

Array
(
    [] => Zé Ramalho
    [celsowm@gmailcom] => aaaaaaaa
    [d] => celso
    [a...@ig.com.br] => wefwerwedwerwe
    [rita.pa...@detran.rj.gov.br] => Rita
    [tiago.rdorififf...@ddddd.com] => tiago
    [b...@gmail.com] => uuuuuuuuuuuuuuuuuu
    [ve...@velho.com] => Velinho da Silva
)

asort($proprietarios) foi a solução...

***Por que?


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Felipe Theodoro  
View profile   Translate to Translated (View Original)
 More options Nov 10, 12:59 pm
From: Felipe Theodoro <ftgoncal...@gmail.com>
Date: Tue, 10 Nov 2009 15:59:41 -0200
Local: Tues, Nov 10 2009 12:59 pm
Subject: Re: [CakePHP-Tuga] Find('list'), dois campos e order não funciona?

qual foi a query qye ele gero?

2009/11/10 Celso <cels...@gmail.com>

--
Felipe Theodoro Gonçalves
ftgoncal...@gmail.com
blog.ftgoncalves.com
--

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Celso  
View profile   Translate to Translated (View Original)
 More options Nov 10, 1:37 pm
From: Celso <cels...@gmail.com>
Date: Tue, 10 Nov 2009 10:37:16 -0800 (PST)
Local: Tues, Nov 10 2009 1:37 pm
Subject: Re: Find('list'), dois campos e order não funciona?
SELECT `Proprietario`.`email`, `Proprietario`.`nome` FROM
`proprietarios` AS `Proprietario` WHERE 1 = 1 ORDER BY `nome` ASC

no banco funciona numa boa... mas o array num vem certo...

On 10 nov, 14:59, Felipe Theodoro <ftgoncal...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Josenivaldo Benito Junior  
View profile   Translate to Translated (View Original)
 More options Nov 10, 3:25 pm
From: Josenivaldo Benito Junior <jrben...@benito.qsl.br>
Date: Tue, 10 Nov 2009 18:25:31 -0200
Local: Tues, Nov 10 2009 3:25 pm
Subject: Re: [CakePHP-Tuga] Re: Find('list'), dois campos e order não funciona?

Felipe,

Faz alguns dias fiz um comentário com problema semelhante ao seu. Naquele
caso eu queria fazer uma find('list') com condições mais complexas mas não
tive sucesso. Sempre que coloco qualquer coisa fora do padrão para o
find('list') ele vira um find('all') ou gera erro. Parece-me que a
implementação do modo 'list' é bem simplória mesmo não vislumbrando usos
mais avançados.

Abraço,

**73 ES DX PU2LBD
*Josenivaldo Benito Junior*
[image: Google Talk:] jrben...@benito.qsl.br [image: Skype:] jjbenito [image:
MSN:] ben...@benito.qsl.br [image: icq:] 2771904
Social me [image: Linkedin] <http://www.linkedin.com/in/jrbenito>[image:
Facebook]<http://www.facebook.com/home.php?ref=home#/profile.php?id=10000032247...>[image:
Flickr] <http://www.flickr.com/photos/jrbenito>[image:
Picasa]<http://picasaweb.google.com.br/jrbenito>[image:
Google Reader] <http://www.google.com/reader/shared/jrbenito>
News: Google anuncia WiFi de graça em 47 aeroportos dos EUA durante
feriados<http://redir.folha.com.br/redir/online/folha/informatica/rss091/*http...>

2009/11/10 Celso <cels...@gmail.com>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rodrigo Rodrigues Moyle  
View profile   Translate to Translated (View Original)
 More options Nov 12, 8:53 pm
From: Rodrigo Rodrigues Moyle <rodrig...@gmail.com>
Date: Thu, 12 Nov 2009 23:53:47 -0200
Local: Thurs, Nov 12 2009 8:53 pm
Subject: Re: [CakePHP-Tuga] Find('list'), dois campos e order não funciona?

Celso pelo que percebi parece que tem e-mails repetidos para nomes
diferentes, por isso está vindo fora da ordem, deixa ver se consigo
explicar:

Se os dados forem assim:

a...@a.com: Alberto
b...@b.com: Bruno
c...@c.com: Carlos
a...@a.com: Zé Roberto

Quando o Cake for colocar isso num array vai ser assim:

1º item: a...@a.com -> Alberto vai ficar:

array(

*...@a.com => Alberto*

)

2º item: b...@b.com -> Bruno:

array(

a...@a.com => Alberto,
*...@b.com => Bruno*

)

3º Item c...@c.com => Carlos:

array(

a...@a.com => Alberto,
b...@b.com => Bruno,
*...@c.com => Carlos*

)

4º Item a...@a.com => Zé Roberto, *muita atenção agora*, como o item a...@a.com já
existe no array, o PHP ao invés de anexar e colocar na ordem, vai
simplesmente substituir o item já existente, então vai ficar assim:

array(

a...@a.com => *Zé Roberto*,
b...@b.com => Bruno,
c...@c.com => Carlos

)

Acho que consegui ser claro na explicação né.

Abraços

2009/11/10 Celso <cels...@gmail.com>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google