Re: saveAll does'nt work
Check my self-answer to my question, I believe it'll help: http://groups.google.com/group/cake-php/browse_thread/thread/a013e1f0ee6689ec On Jul 31, 11:41 am, Gildonei Mendes A. (Junior) anjol...@gmail.com wrote: I'm also have some problems withsaveAll. This are the content of this data and the relations of my model. # $this-data Array ( [Usuario] = Array ( [PK_usuario] = [flPf] = 1 [strNome] = Gildonei Mendes Anacleto Junior [strLogin] = root [strSenha] = af47g5t [strEmail] = jun...@sitecomarte.com.br [intTelefone] = [intCelular] = (48)8413-4280 [flSexoMasc] = 1 [tpUsuario] = 2 [flAtivo] = 1 ) [UsuarioPf] = Array ( [strRg] = 3879169 [intCpf] = 034.306.469-36 ) [Endereco] = Array ( [0] = Array ( [FK_estado] = 24 [FK_cidade] = 10 [strBairro] = Capoeiras [strEndereco] = Srv. Alzira Ventura Vieira [intNumero] = 40 [intCep] = 88090175 [strComplemento] = Bloco 04 Apto 301 ) ) ) # Model Usuario class Usuario extends AppModel { public $name = 'Usuario'; public $useTable = 'usuarios'; public $primaryKey = 'PK_usuario'; public $hasOne = array( 'UsuarioPf' = array( 'className' = 'UsuarioPf', 'foreignKey' = 'PK_usuario', 'type' = 'LEFT' ), 'UsuarioPj' = array( 'className' = 'UsuarioPj', 'foreignKey' = 'PK_usuario', 'type' = 'LEFT' ) ); #Model UsuarioPf class UsuarioPf extends AppModel { public $name = 'UsuarioPf'; public $useTable = 'usuario_pfs'; public $primaryKey = 'PK_usuario'; public $displayField = 'intCpf'; public $belongsTo = array( 'Usuario' = array( 'className' = 'Usuario', 'foreignKey' = 'PK_usuario', 'type' = 'INNER' ) ); # Model Endereco class Endereco extends AppModel { public $name = 'Endereco'; public $useTable = 'enderecos'; public $primaryKey = 'PK_endereco'; public $belongsTo = array( 'Cidade' = array( 'className' = 'Cidade', 'foreignKey' = 'FK_cidade', 'type' = 'INNER' ), 'Usuario' = array( 'className' = 'Usuario', 'foreignKey' = 'FK_usuario', 'type' = 'INNER' ) ); # SQL CallBacks 1 DESCRIBE `usuarios` 10 10 3 2 DESCRIBE `usuario_pfs` 3 3 4 3 DESCRIBE `usuario_pjs` 4 4 4 4 DESCRIBE `enderecos` 7 7 4 5 DESCRIBE `cidades` 3 3 4 6 DESCRIBE `estados` 3 3 3 7 DESCRIBE `pagamentos` 4 4 4 8 DESCRIBE `setores` 5 5 4 9 DESCRIBE `imagens` 9 9 4 10 SELECT `Usuario`.`PK_usuario` FROM `usuarios` AS `Usuario` LEFT JOIN `usuario_pfs` AS `UsuarioPf` ON (`UsuarioPf`.`PK_usuario` = `Usuario`.`PK_usuario`) LEFT JOIN `usuario_pjs` AS `UsuarioPj` ON (`UsuarioPj`.`PK_usuario` = `Usuario`.`PK_usuario`) WHERE `strLogin` = 'root' AND `Usuario`.`PK_usuario` LIMIT 1 0 0 1 11 START TRANSACTION 0 1 12 ROLLBACK 0 1 13 SELECT `Estado`.`PK_estado`, `Estado`.`strNome` FROM `estados` AS `Estado` WHERE 1 = 1 27 27 1 14 SELECT `Setor`.`PK_setor`, `Setor`.`strNome`, `Setor`.`strDescricao`, `Setor`.`strController`, `Setor`.`flMenu` FROM `setores` AS `Setor` WHERE `flMenu` = 1 10 10 1 15 SELECT `Imagem`.`PK_imagem`, `Imagem`.`FK_setor`, `Imagem`.`FK_registro`, `Imagem`.`strNome`, `Imagem`.`strNomeDisco`, `Imagem`.`strMime`, `Imagem`.`intSize`, `Imagem`.`intWidth`, `Imagem`.`intHeight` FROM `imagens` AS `Imagem` WHERE `Imagem`.`FK_setor` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) 0 0 0 Does anyone can help us? Ty. On 30 jul, 04:04, Vijay Kumbhar k.vidn...@gmail.com wrote: It is not working while saving the data while adding the data or while editing the existing data? I have the same problem with cakephp 1.3 but while editing the associated
Re: saveAll does'nt work
I'm also have some problems with saveAll. This are the content of this data and the relations of my model. # $this-data Array ( [Usuario] = Array ( [PK_usuario] = [flPf] = 1 [strNome] = Gildonei Mendes Anacleto Junior [strLogin] = root [strSenha] = af47g5t [strEmail] = jun...@sitecomarte.com.br [intTelefone] = [intCelular] = (48)8413-4280 [flSexoMasc] = 1 [tpUsuario] = 2 [flAtivo] = 1 ) [UsuarioPf] = Array ( [strRg] = 3879169 [intCpf] = 034.306.469-36 ) [Endereco] = Array ( [0] = Array ( [FK_estado] = 24 [FK_cidade] = 10 [strBairro] = Capoeiras [strEndereco] = Srv. Alzira Ventura Vieira [intNumero] = 40 [intCep] = 88090175 [strComplemento] = Bloco 04 Apto 301 ) ) ) # Model Usuario class Usuario extends AppModel { public $name = 'Usuario'; public $useTable = 'usuarios'; public $primaryKey = 'PK_usuario'; public $hasOne = array( 'UsuarioPf' = array( 'className' = 'UsuarioPf', 'foreignKey' = 'PK_usuario', 'type' = 'LEFT' ), 'UsuarioPj' = array( 'className' = 'UsuarioPj', 'foreignKey' = 'PK_usuario', 'type' = 'LEFT' ) ); #Model UsuarioPf class UsuarioPf extends AppModel { public $name = 'UsuarioPf'; public $useTable = 'usuario_pfs'; public $primaryKey = 'PK_usuario'; public $displayField = 'intCpf'; public $belongsTo = array( 'Usuario' = array( 'className' = 'Usuario', 'foreignKey' = 'PK_usuario', 'type' = 'INNER' ) ); # Model Endereco class Endereco extends AppModel { public $name = 'Endereco'; public $useTable = 'enderecos'; public $primaryKey = 'PK_endereco'; public $belongsTo = array( 'Cidade' = array( 'className' = 'Cidade', 'foreignKey' = 'FK_cidade', 'type' = 'INNER' ), 'Usuario' = array( 'className' = 'Usuario', 'foreignKey' = 'FK_usuario', 'type' = 'INNER' ) ); # SQL CallBacks 1 DESCRIBE `usuarios` 10 10 3 2 DESCRIBE `usuario_pfs` 3 3 4 3 DESCRIBE `usuario_pjs` 4 4 4 4 DESCRIBE `enderecos`7 7 4 5 DESCRIBE `cidades` 3 3 4 6 DESCRIBE `estados` 3 3 3 7 DESCRIBE `pagamentos` 4 4 4 8 DESCRIBE `setores` 5 5 4 9 DESCRIBE `imagens` 9 9 4 10 SELECT `Usuario`.`PK_usuario` FROM `usuarios` AS `Usuario` LEFT JOIN `usuario_pfs` AS `UsuarioPf` ON (`UsuarioPf`.`PK_usuario` = `Usuario`.`PK_usuario`) LEFT JOIN `usuario_pjs` AS `UsuarioPj` ON (`UsuarioPj`.`PK_usuario` = `Usuario`.`PK_usuario`) WHERE `strLogin` = 'root' AND `Usuario`.`PK_usuario` LIMIT 1 0 0 1 11 START TRANSACTION 0 1 12 ROLLBACK0 1 13 SELECT `Estado`.`PK_estado`, `Estado`.`strNome` FROM `estados` AS `Estado` WHERE 1 = 127 27 1 14 SELECT `Setor`.`PK_setor`, `Setor`.`strNome`, `Setor`.`strDescricao`, `Setor`.`strController`, `Setor`.`flMenu` FROM `setores` AS `Setor` WHERE `flMenu` = 1 10 10 1 15 SELECT `Imagem`.`PK_imagem`, `Imagem`.`FK_setor`, `Imagem`.`FK_registro`, `Imagem`.`strNome`, `Imagem`.`strNomeDisco`, `Imagem`.`strMime`, `Imagem`.`intSize`, `Imagem`.`intWidth`, `Imagem`.`intHeight` FROM `imagens` AS `Imagem` WHERE `Imagem`.`FK_setor` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) 0 0 0 Does anyone can help us? Ty. On 30 jul, 04:04, Vijay Kumbhar k.vidn...@gmail.com wrote: It is not working while saving the data while adding the data or while editing the existing data? I have the same problem with cakephp 1.3 but while editing the associated model data using saveAll. If it is not saving the data while editing then in cakephp 1.3 you have to specify the related model primary key with the edited record. You have to take the profile id field in you form. So that you can get it after posting the form. $this-User-UserProfile-id = $this-data['UserProfile']['id']; If you
Re: saveAll does'nt work
It is not working while saving the data while adding the data or while editing the existing data? I have the same problem with cakephp 1.3 but while editing the associated model data using saveAll. If it is not saving the data while editing then in cakephp 1.3 you have to specify the related model primary key with the edited record. You have to take the profile id field in you form. So that you can get it after posting the form. $this-User-UserProfile-id = $this-data['UserProfile']['id']; If you have defined your associations correctly between the models then it has to work. If you have the relation then please recheck the associations or please put the code here so that we can verify it tell you appropriate solution. On Fri, Jul 30, 2010 at 11:29 AM, Norman Paniagua normanpania...@gmail.comwrote: Can you put the model code? --- Norman Paniagua 2010/7/30 Jeremy shimeilin1...@gmail.com today, I find function saveAll can not work ,when save data into two relations tables, blew is the data, Array ( [User] = Array ( [username] = tester [password] = 17acdc1ee8e4ed05e9d27fce4df6d4b5de036910 [email] = tes...@admin.com [country_id] = 180 [captcha_input] = uhrfca [reg_ip] = 172.16.5.73 [confirm_code] = 4c526005-2038-4c84-b01f-0ccec0a8061f ) [UserProfile] = Array ( [birth] = 2009-02-12 ) ), and mysql ENGINE is MyISAM , anyone know the reason ? help me !!! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Thanks Regards, Vijayk. You Bring the Dreams, We'll Bring the Means Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
saveAll does'nt work
today, I find function saveAll can not work ,when save data into two relations tables, blew is the data, Array ( [User] = Array ( [username] = tester [password] = 17acdc1ee8e4ed05e9d27fce4df6d4b5de036910 [email] = tes...@admin.com [country_id] = 180 [captcha_input] = uhrfca [reg_ip] = 172.16.5.73 [confirm_code] = 4c526005-2038-4c84-b01f-0ccec0a8061f ) [UserProfile] = Array ( [birth] = 2009-02-12 ) ), and mysql ENGINE is MyISAM , anyone know the reason ? help me !!! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: saveAll does'nt work
Can you put the model code? --- Norman Paniagua 2010/7/30 Jeremy shimeilin1...@gmail.com today, I find function saveAll can not work ,when save data into two relations tables, blew is the data, Array ( [User] = Array ( [username] = tester [password] = 17acdc1ee8e4ed05e9d27fce4df6d4b5de036910 [email] = tes...@admin.com [country_id] = 180 [captcha_input] = uhrfca [reg_ip] = 172.16.5.73 [confirm_code] = 4c526005-2038-4c84-b01f-0ccec0a8061f ) [UserProfile] = Array ( [birth] = 2009-02-12 ) ), and mysql ENGINE is MyISAM , anyone know the reason ? help me !!! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en