|
|
@@ -3147,7 +3147,8 @@ class MarshallerTest extends TestCase
|
|
|
$data['user']['username'] = 'robert';
|
|
|
|
|
|
$options['associated'] = ['Users'];
|
|
|
- });
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
$entity = $marshall->one($data);
|
|
|
|
|
|
@@ -3196,31 +3197,36 @@ class MarshallerTest extends TestCase
|
|
|
|
|
|
$this->assertArrayHasKey('association', $options);
|
|
|
$this->assertInstanceOf('Cake\ORM\Association', $options['association']);
|
|
|
- });
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
$this->articles->users->eventManager()->on(
|
|
|
'Model.beforeMarshal',
|
|
|
function ($e, $data, $options) {
|
|
|
$data['secret'] = 'h45h3d';
|
|
|
- });
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
$this->articles->comments->eventManager()->on(
|
|
|
'Model.beforeMarshal',
|
|
|
function ($e, $data) {
|
|
|
$data['comment'] .= ' (modified)';
|
|
|
- });
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
$this->articles->tags->eventManager()->on(
|
|
|
'Model.beforeMarshal',
|
|
|
function ($e, $data) {
|
|
|
$data['tag'] .= ' (modified)';
|
|
|
- });
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
$this->articles->tags->junction()->eventManager()->on(
|
|
|
'Model.beforeMarshal',
|
|
|
function ($e, $data) {
|
|
|
$data['modified_by'] = 1;
|
|
|
- });
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
$entity = $marshall->one($data, [
|
|
|
'associated' => ['Users', 'Comments', 'Tags']
|