Skip to content

Instantly share code, notes, and snippets.

@brabeji
Created April 11, 2015 12:43
Show Gist options
  • Save brabeji/db863b838248fb46b3a9 to your computer and use it in GitHub Desktop.
Save brabeji/db863b838248fb46b3a9 to your computer and use it in GitHub Desktop.
CakePHP 3.0 question - Creating association by assigning entity

Assuming Posts belongsTo Category is it possible to patchEntity of existing Post with this:

{
  "title": "foo",
  "category": {
    "id": 2,
    "title": "new title for category 2"
  }
}

to edit that post, create association between that specific post and Category with id 2 and possibly edit title of that category?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment