Re: Cakephp 3.x patchEntity set "'new' => true" to entity in edit function
Thanks for the update, I am glad to hear that it is working for you. It seems to me that in order for the system to know which record is being updated, that all of the ids should need to be supplied for every record that is being saved in a transaction. If it is saving a record for which you did not supply an id, then it must be able to figure out the id via the relationship but can't do that with addresses when there can be multiple addresses that are related. Best regards, Kevin -- Sign up for our Newsletter for updates. http://cakephp.org/newsletter/signup We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon. Like Us on FaceBook https://www.facebook.com/CakePHP Follow us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Cakephp 3.x patchEntity set "'new' => true" to entity in edit function
Hi Kevin, It worked perfectly!! I just would lime to know why only Addresses need the id. But if you dont know, thats OK. You already relped me!! Thanks a lot! Best regards, Paulo Terra -- Sign up for our Newsletter for updates. http://cakephp.org/newsletter/signup We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon. Like Us on FaceBook https://www.facebook.com/CakePHP Follow us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Cakephp 3.x patchEntity set "'new' => true" to entity in edit function
I am not sure why the others appear to be working, I suggest that you test thoroughly to make sure they are doing as expected. It may be because of the many - to -one relationship though. Let me know how it goes. Regards, Kevin -- Sign up for our Newsletter for updates. http://cakephp.org/newsletter/signup We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon. Like Us on FaceBook https://www.facebook.com/CakePHP Follow us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Cakephp 3.x patchEntity set "'new' => true" to entity in edit function
Hi Kekin, it is very kind of you help this poor Cake novice. It have been hard programing days. Ok, if I have a hidden ID field of the Addresses I think it is going to work. But why do I have to put the Addresses ID and the other entities work without it? Here is the form: PS: Thanks again for your patience Form->create($buyer); ?> Form->input('user.name',['label' => __('Nome')]);?> Form->input('cpf',['label' => __('CPF')]);?> Form->input('user.username',['label' => __('Email')]);?> Form->label(__('Sexo'));?> __('Masculino'), 'Feminino' => __('Feminino'));?> Form->radio('gender', $options);?> Form->label('birthdate',__('Data de nascimento'));?> Form->input( 'birthdate', array ( 'label'=> false, 'minYear' => date('Y') - 100, 'maxYear' => date('Y') - 12, 'empty'=> true, 'monthNames'=> true, 'default'=> '' ) ); ?> Form->input('user.addresses.0.phone',['label' => __('Telefone')]);?> Form->input('user.addresses.0.celphone',['label' => __('Celular')]);?> Form->input('user.addresses.0.zipcode',['label' => __('CEP')]);?> Form->input('user.addresses.0.line1',['label' => __('Endereço e número')]);?> Form->input('user.addresses.0.line2',['label' => __('Complemento e Bairro')]);?> Form->input('user.addresses.0.city',['label' => __('Cidade')]);?> Form->input('user.addresses.0.state',['label' => __('Estado')]);?> Form->input('user.addresses.0.country_id',['options' => $countries,'label' => __('PaÃs')]);?> Form->label(__('Preferências musicais')); echo $this->Form->input('genres._ids', [ 'templates' => ['checkboxWrapper' => '{{label}}'], 'options' => $genres, 'multiple' => 'checkbox', 'label' => false, //'value' => $buyer ]); ?> Form->label(__('Receber novidades'));?> Form->input('newsletter',['type' => 'checkbox','value' => 'Sim','hiddenField'=>'Não', 'label' => __('Quero receber email de novidades do Prefiro Vinil')]);?> Form->button(__('Salvar'), ['class' => 'btn-success']) ?> Form->end() ?> Em quarta-feira, 20 de abril de 2016 01:11:37 UTC-3, heavyKevy escreveu: > > Does your edit form have an input for the address_id? > > something like:"user.addresses.0.id" > > I see the id: (29) for the address in the debug output of the entity... > > If you need further help with it, you are going to need to show the edit > form in order to figure out what may be missing. > > Hope that helps... > Best regards, > Kevin > > -- Sign up for our Newsletter for updates. http://cakephp.org/newsletter/signup We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon. Like Us on FaceBook https://www.facebook.com/CakePHP Follow us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "C
Re: Cakephp 3.x patchEntity set "'new' => true" to entity in edit function
Does your edit form have an input for the address_id? something like:"user.addresses.0.id" I see the id: (29) for the address in the debug output of the entity... If you need further help with it, you are going to need to show the edit form in order to figure out what may be missing. Hope that helps... Best regards, Kevin -- Sign up for our Newsletter for updates. http://cakephp.org/newsletter/signup We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon. Like Us on FaceBook https://www.facebook.com/CakePHP Follow us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Cakephp 3.x patchEntity set "'new' => true" to entity in edit function
Hi heavyKevy, thank you for your answer! Ok, about your first advise, I simplified and its ok, but about the issue, that´s it, the problem is the missind ID. But I simlpy don´t know why all other entitys comes with the id and Addresses not! That is the problem. Do you know why? Thanks in advance! Paulo Terra Em segunda-feira, 18 de abril de 2016 04:50:18 UTC-3, heavyKevy escreveu: > > First off you don't need to cotain users 3 times, > Users.Addresses.Countries includes all 3 tables already. > > Secondly, if the address has the id, it should automatically detect that > it is being edited, if the id is missing it will add the address. > -- Sign up for our Newsletter for updates. http://cakephp.org/newsletter/signup We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon. Like Us on FaceBook https://www.facebook.com/CakePHP Follow us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.