Log message #4123942

# At Username Text
# Mar 12th 2018, 07:43 joddit Just re add whatever customizations you added of course
# Mar 12th 2018, 07:43 aneh :slightly_smiling_face:
# Mar 12th 2018, 07:43 aneh thanks a lot
# Mar 12th 2018, 07:42 joddit Glad you got it working
# Mar 12th 2018, 07:42 joddit Oh great
# Mar 12th 2018, 07:42 joddit You'll need 'address_id' => true as well in your address_header entity
# Mar 12th 2018, 07:42 aneh thankyou :+1: it was working now i bake my model again and it start saving data
# Mar 12th 2018, 07:37 joddit add 'address' => true to your address_headers entity
# Mar 12th 2018, 07:37 joddit If you're not confident in writing your own models and table, definitely make use of the bake program
# Mar 12th 2018, 07:36 joddit Did you bake these or write them yourslef?
# Mar 12th 2018, 07:36 joddit I see that you don't have addresses in your address_headers entity as well
# Mar 12th 2018, 07:32 bravo-kernel @savant thank you so much for your reviews, could never have spotted those myself :100
# Mar 12th 2018, 07:31 aneh No still not saving plz check this gist https://gist.github.com/anehkumar/d582bac8d595d8dcdf15d8879b00d63f if you find any error in code
# Mar 12th 2018, 07:27 joddit Let me know if that works
# Mar 12th 2018, 07:27 joddit You were only patching it with the association specified but not saving it with the association specified
# Mar 12th 2018, 07:27 joddit Your save call should be $this->AddressHeaders->save($entity, ['associated' => 'Addresses']
# Mar 12th 2018, 07:26 aneh Plz tell me how to fix
# Mar 12th 2018, 07:25 joddit Oh I see it now
# Mar 12th 2018, 07:19 aneh but get same result
# Mar 12th 2018, 07:19 aneh $data = [ 'user_id' => 1, 'company_id' => 9, 'addresses' => [ [ 'user_id' => 1, 'company_id' => 9, 'name' => 'Aneh' ] ] ];
# Mar 12th 2018, 07:19 aneh i also try with this data
# Mar 12th 2018, 07:18 joddit It should have addresses plural and have an index key
# Mar 12th 2018, 07:18 joddit Right so you need to change your data array
# Mar 12th 2018, 07:18 aneh $this->hasMany('Addresses', [ 'foreignKey' => 'address_header_id' ]);
# Mar 12th 2018, 07:18 aneh yes
# Mar 12th 2018, 07:16 joddit Right but you've defined the association as address_headers hasMany addresses right?
# Mar 12th 2018, 07:14 aneh My address entity table protected $_accessible = [ 'user_id' => true, 'company_id' => true, 'address_header_id' => true, 'name' => true, ]; and address_header table entity protected $_accessible = [ 'id' => true, 'user_id' => true, 'company_id' => true, 'created_date' => true, ];
# Mar 12th 2018, 07:11 joddit Can check the FormHpage for how to structure associated data https://book.cakephp.org/3.0/en/views/helpers/form.html#creating-inputs-for-associated-data
# Mar 12th 2018, 07:11 joddit Something like this https://gist.github.com/anonymous/3201973ab3ab52023829d66bd2d5ee2b
# Mar 12th 2018, 07:09 joddit of addresses, not a single address
# Mar 12th 2018, 07:09 joddit your 'addresses key should be an indexed array
# Mar 12th 2018, 07:06 joddit Maybe your 'address' key needs to be 'addresses'[0]
# Mar 12th 2018, 07:06 joddit Since it's not a hasOne
# Mar 12th 2018, 07:06 joddit Try formatting your data differently
# Mar 12th 2018, 07:04 joddit My guess is, it is ignoring your address data
# Mar 12th 2018, 07:04 joddit See if the fields are even being caught and marked dirty
# Mar 12th 2018, 07:04 joddit Check your entity
# Mar 12th 2018, 07:04 joddit Hrmm
# Mar 12th 2018, 07:04 aneh i get same result even if i set atomic=> false
# Mar 12th 2018, 07:04 joddit Well your association code look proper, the data that you're attempting to save looks proper and the controller code looks proper to be honest.
# Mar 12th 2018, 07:00 aneh Cake is not save data in address table