0

I have Campaigns and Actions. Each Campaign can has unlimited actions (even can be repeated).

Cakephp documentation say you can save the asociation with actions._ids but I have a problem with this. Each campaign_action has a duration. Then if I use actions._ids I can save the relationship without problems but I can't save duration in each campaign_duration.

Now I am saving with this data:

actions => [
0 => [
    id  => 3,
    _joinData => [
        duration => 40,
    ],
],
1 => [
    id  => 5,
    _joinData => [
        duration => 25,
    ],
],
]

The problem is that if I have same "action" but with different "duration" it saves me only 1 "campaign_action" (the lastest).

actions => [
0 => [
    id  => 3,
    _joinData => [
        duration => 40,
    ],
],
1 => [
    id  => 5,
    _joinData => [
        duration => 25,
    ],
],
2 => [
    id  => 3,
    _joinData => [
        duration => 15,
    ],
],
]

How can I do this?

Sergioh Lonet
  • 831
  • 1
  • 7
  • 9
  • **https://stackoverflow.com/questions/50761347/multiple-entitiy-relation#comment88535188_50761347** You may also want to keep an eye on **https://github.com/cakephp/cakephp/issues/12205**. – ndm Jun 13 '18 at 20:22
  • Is the solution. I think that is not the corret way but if there are not any way... – Sergioh Lonet Jun 14 '18 at 11:07

1 Answers1

0

stackoverflow.com/questions/50761347/… You may also want to keep an eye on github.com/cakephp/cakephp/issues/12205

Sergioh Lonet
  • 831
  • 1
  • 7
  • 9