Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Salvar tipos diferentes em relações habtm
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
  3 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
 
Edinei L. Cipriani  
View profile   Translate to Translated (View Original)
 More options Nov 11, 12:55 pm
From: "Edinei L. Cipriani" <phpedi...@gmail.com>
Date: Wed, 11 Nov 2009 15:55:03 -0200
Local: Wed, Nov 11 2009 12:55 pm
Subject: Salvar tipos diferentes em relações habtm

Olá pessoal

tenho uma dúvida com o salvamento de uma relação habtm

Tenho as classes: Aluno, Pai, Mae, Responsavel que usam a tabela usuarios,
useTable = usuarios

E tenho outra tabela chamada tipos, com uma relação m:n (habtm) para
usuarios

Meu problema está na hora de salvar o tipo de usuario em apenas um form,
segue exemplo:

echo $form->create('Aluno');
echo $form->input('Tipo.0.tipo_id', array('type' => 'hidden','value'=> 1));
echo $form->input('nome');

echo $form->input('Pai.Tipo.0.tipo_id', array('type' => 'hidden','value'=>
2));
echo $form->input('Pai.nome');

echo $form->end('Salvar');

Obs, o tipo do pai não esta salvando.

Sei que com callbacks (afterSave) eu soluciono isso, gostaria de saber se
alguém sabe de alguma alternativa para isso, pois havera casos que será
dinâmico, ou seja, o usuario que vai ter q salvar o tipo de usuario que será
cadastrado.

Abrs.
--
Edinei L. Cipriani
Blog: http://phpedinei.wordpress.com
Twitter: http://www.twitter.com/phpedinei

Desenvolvedor Colégio Trilingue Inovação
Site: http://www.colegioinovacao.com.br
Cursando Sistemas de Informação  - Unoesc Chapecó 1 Período
Integrante do grupo Fool N Lost de algoritimos computacionais
Fone 49 84149086


    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.
Sergio Macedo  
View profile   Translate to Translated (View Original)
 More options Nov 11, 3:20 pm
From: Sergio Macedo <sergi...@gmail.com>
Date: Wed, 11 Nov 2009 18:20:17 -0200
Local: Wed, Nov 11 2009 3:20 pm
Subject: Re: [CakePHP-Tuga] Salvar tipos diferentes em relações habtm

Se não me engano você terá que salvar com:

$this->Aluno->saveall( $this->data);

Vai um link ai... de um exemplo parecido:
http://forum.imasters.uol.com.br/index.php?/topic/370225-dica-rapida-...

Até mais
Sérgio Macedo

2009/11/11 Edinei L. Cipriani <phpedi...@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.
Edinei L. Cipriani  
View profile   Translate to Translated (View Original)
 More options Nov 11, 4:42 pm
From: "Edinei L. Cipriani" <phpedi...@gmail.com>
Date: Wed, 11 Nov 2009 19:42:53 -0200
Local: Wed, Nov 11 2009 4:42 pm
Subject: Re: [CakePHP-Tuga] Re: Salvar tipos diferentes em relações habtm

Olá amigo, ja estou salvando com saveAll porém ele nao relaciona o tipo ao
pai do aluno.

Se souber outra solução fico no aguardo.

2009/11/11 Sergio Macedo <sergi...@gmail.com>

--
Edinei L. Cipriani
Blog: http://phpedinei.wordpress.com
Twitter: http://www.twitter.com/phpedinei

Desenvolvedor Colégio Trilingue Inovação
Site: http://www.colegioinovacao.com.br
Cursando Sistemas de Informação  - Unoesc Chapecó 1 Período
Integrante do grupo Fool N Lost de algoritimos computacionais
Fone 49 84149086


    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