# |
Mar 12th 2018, 09:21 |
neon1024 |
Morning everyone |
# |
Mar 12th 2018, 09:16 |
dereuromark |
There are not many other things that can be wrong IMO. |
# |
Mar 12th 2018, 09:16 |
dereuromark |
Which to me sounds like a cache issue. It doesnt yet know the schema. |
# |
Mar 12th 2018, 08:52 |
joddit |
Wha? |
# |
Mar 12th 2018, 08:48 |
bakro.istvan |
No I havent I will try it..., but I with debugkit that the PUT request does queries the db for the new tag and it does not exists. After that I am missing the INSERT query :( |
# |
Mar 12th 2018, 07:43 |
joddit |
:clap: |
# |
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 |