Wednesday, June 25, 2014

Re: what is request array to save multiple records in cakephp3 ?

Thanks for reply, I moved from CakePHP 3 to CakePHP 2 , So I don't need reply any more.

On Wednesday, 25 June 2014 03:11:46 UTC+5:30, José Lorenzo wrote:
I just tried a similar application to yours and I could successfully save all the related records. Could you please use gist.github.com to sow your code?

On Monday, June 23, 2014 2:15:35 PM UTC+2, Archana Goyal wrote:
Hi Lorenzo,

Still my code is not working.

after newEntity() resume array
App\Model\Entity\Resume Object  (      [_accessible:protected] => Array          (              [*] => 1          )        [_properties:protected] => Array          (              [alternate_email] =>               [mobile] => 23232              [phone] =>               [address1] =>               [address2] =>               [country_id] =>               [state_id] =>               [city_id] =>               [city_other] =>               [zipcode] =>               [level] => Student              [linkedin] =>               [facebook] =>               [twitter] =>               [youtube] =>               [links] => Array                  (                      [0] => Cake\ORM\Entity Object                          (                              [_properties:protected] => Array                                  (                                      ['url'] => ssssssssss                                      ['user_id'] => 1                                  )                                [_hidden:protected] => Array                                  (                                  )                                [_virtual:protected] => Array                                  (                                  )                                [_className:protected] => Cake\ORM\Entity                              [_dirty:protected] => Array                                  (                                      ['url'] => 1                                      ['user_id'] => 1                                  )                                [_new:protected] =>                               [_errors:protected] => Array                                  (                                  )                                [_accessible:protected] => Array                                  (                                      [*] => 1                                  )                                [_repositoryAlias:protected] => Links                          )                        [1] => Cake\ORM\Entity Object                          (                              [_properties:protected] => Array                                  (                                      ['url'] => zzzzzzzzzzz                                      ['user_id'] => 1                                  )                                [_hidden:protected] => Array                                  (                                  )                                [_virtual:protected] => Array                                  (                                  )                                [_className:protected] => Cake\ORM\Entity                              [_dirty:protected] => Array                                  (                                      ['url'] => 1                                      ['user_id'] => 1                                  )                                [_new:protected] =>                               [_errors:protected] => Array                                  (                                  )                                [_accessible:protected] => Array                                  (                                      [*] => 1                                  )                                [_repositoryAlias:protected] => Links                          )                    )            )        [_hidden:protected] => Array          (          )        [_virtual:protected] => Array          (          )        [_className:protected] => App\Model\Entity\Resume      [_dirty:protected] => Array          (              [alternate_email] => 1              [mobile] => 1              [phone] => 1              [address1] => 1              [address2] => 1              [country_id] => 1              [state_id] => 1              [city_id] => 1              [city_other] => 1              [zipcode] => 1              [level] => 1              [linkedin] => 1              [facebook] => 1              [twitter] => 1              [youtube] => 1              [links] => 1          )        [_new:protected] =>       [_errors:protected] => Array          (          )        [_repositoryAlias:protected] => Resumes  )



On Monday, 23 June 2014 17:36:34 UTC+5:30, José Lorenzo wrote:
Try with $_accessible = ['*' => true];

Also show a debug of the entity after calling newEntity()

On Monday, June 23, 2014 1:43:58 PM UTC+2, Archana Goyal wrote:
Hi,

my Resume.php is

<?php
namespace App\Model\Entity;

use Cake\ORM\Entity;

class Resume extends Entity {
      protected $_accessible = ['links' => true ];
}
?>

but its not working.

On Monday, 23 June 2014 16:38:38 UTC+5:30, José Lorenzo wrote:
In your Resume.php entity file, you probably need to add 'links'  => 1 to the $_accessible array

On Monday, June 23, 2014 8:41:56 AM UTC+2, Archana Goyal wrote:
Hi,
I am building cakephp 3 application. I want to save associated multiple records.
my $this->request->data is
Array  (         [name] => archana
[phone] => 234234
  [links] => Array ( [0] => Array ( ['link'] => www.google.com ['user_id'] => 1 ) ) )

In my associate table data saved like

id | link | user_id | resume_id
1 | | | 1

and I want like this
id | link               | user_id | resume_id
1 | www.google.com | 1 | 1

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find 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+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: