Skip to content

Instantly share code, notes, and snippets.

@styks1987
Last active May 10, 2017 14:19
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 styks1987/5ce416f69d7543febf3a5715e67893d1 to your computer and use it in GitHub Desktop.
Save styks1987/5ce416f69d7543febf3a5715e67893d1 to your computer and use it in GitHub Desktop.
<?php
public function beforeMarshal(Event $event, \ArrayObject $data, \ArrayObject $options)
{
$entityClass = $this->getEntityClass();
$propertyMap = (new $entityClass())->_map;
foreach($propertyMap as $new => $old){
if($data->offsetExists($new)){
$data->offsetSet($old, $data->offsetGet($new));
$data->offsetUnset($new);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment