Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Problema com displayField
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
  2 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
 
Fábio  
View profile   Translate to Translated (View Original)
 More options Jun 25, 4:17 pm
From: Fábio <fabiobmlaz...@gmail.com>
Date: Thu, 25 Jun 2009 13:17:07 -0700 (PDT)
Local: Thurs, Jun 25 2009 4:17 pm
Subject: Problema com displayField
Opa pessoal.
Tenho o Model X e Y
O model X pertence ao Model Y
No controller do X, eu fiz um find('list') pra alimentar um select que
estou
fazendo. Porém, na tabela X há apenas os campos id, y_id
No Y que tem o name... E é esse name que eu devo mostrar nos options
do meu
select. Só que quando lá no X eu faço um $displayField = array
('Y.name'),
ele diz que a coluna é desconhecida.
Como posso fazer pra exibir o name?
Obrigado a todos.

    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.
Altieres  
View profile   Translate to Translated (View Original)
 More options Jun 27, 2:38 pm
From: Altieres <altiereslo...@gmail.com>
Date: Sat, 27 Jun 2009 11:38:39 -0700 (PDT)
Local: Sat, Jun 27 2009 2:38 pm
Subject: Re: Problema com displayField
Fábio,

Até onde sei realmente o find list não faz joins...
Não consegui entender muito bem porque você precisa disso, visto que
os names de Y correspondem aos ids de Y, mas vamos lá...

Faça um find all normalmente, que retornará algo como:

# $a = array(
# array(
# 'User' => array(
# 'id' => 2,
# 'group_id' => 1,
# 'Data' => array(
# 'user' => 'mariano.iglesias',
# 'name' => 'Mariano Iglesias'
# )
# )
# ),
# array(
# 'User' => array(
# 'id' => 14,
# 'group_id' => 2,
# 'Data' => array(
# 'user' => 'phpnut',
# 'name' => 'Larry E. Masters'
# )
# )
# ),
# array(
# 'User' => array(
# 'id' => 25,
# 'group_id' => 1,
# 'Data' => array(
# 'user' => 'gwoo',
# 'name' => 'The Gwoo'
# )
# )
# )
# );

Fazendo:
# $result = Set::combine($a, '{n}.User.id', '{n}.User.Data.name');

Você terá o que deseja:
# Array
# (
# [2] => Mariano Iglesias
# [14] => Larry E. Masters
# [25] => The Gwoo
# )
# */

referência:
http://book.cakephp.org/view/662/combine

att,

---
Altieres Lopes
WebGoal.com.br
Simplificando Softwares

On 25 jun, 17:17, Fábio <fabiobmlaz...@gmail.com> wrote:


    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