Skip to content

Instantly share code, notes, and snippets.

@hmic
Created December 19, 2017 15:38
Show Gist options
  • Save hmic/ea8b558f0733ce3c8b7b75d9513db300 to your computer and use it in GitHub Desktop.
Save hmic/ea8b558f0733ce3c8b7b75d9513db300 to your computer and use it in GitHub Desktop.
CakePHP 3.x Table::beforeMarshall
<?php
class ParticipantsTable extends AppTable
{
public function beforeMarshal(Event $event, \ArrayObject $data, \ArrayObject $options) {
if(isset($data['partner']) && is_array($data['partner'])) {
$participant = $this->get($data['id']);
$data['partner']['participant_type_id'] = $participant->type_id;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment