Skip to content

Instantly share code, notes, and snippets.

@markstory
Created July 31, 2014 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markstory/2c57e14321fbc00ba343 to your computer and use it in GitHub Desktop.
Save markstory/2c57e14321fbc00ba343 to your computer and use it in GitHub Desktop.
Trying to reproduce the issue José was talking about.
/**
* Tests that patchEntity includes _joinData
* all associations
*
* @return void
*/
public function testPatchEntityJoinData() {
$articles = TableRegistry::get('Articles');
$articles->belongsToMany('Tags');
$entity = new \Cake\ORM\Entity;
$data = [
'title' => 'testing',
'tags' => [
[
'tag' => 'CakePHP',
'_joinData' => ['active' => 1]
],
[
'tag' => 'Internet',
'_joinData' => ['active' => 1]
],
]
];
$articles->patchEntity($entity, $data);
$this->assertInstanceOf('Cake\ORM\Entity', $entity->tags[0]->_joinData);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment