Monday, August 11, 2014

3.0 Can you save and create entities simultainiously for belongsToMany relationsips

When saving data that have new relations and a selection of relations only the selection gets updated and new relations get discarded.

example post:

    [id] => 1
    [title] => entry 1
    [relations] => Array
        (
            [_ids] => Array
                (
                    [0] => 1
                    [1] => 3
                ),
            [0] => Array
                (
                    [status] => 1
                    [title] =>   test
                )
        )

Is there a way to pass the data that will allow a user to select relations + create new ones if they do not exist or do I need to create some kind of data preprocessor to create the new entities and add their ids to the _ids key before sending the data to the marshaller?

--
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: