Last active
May 10, 2017 14:19
-
-
Save styks1987/5ce416f69d7543febf3a5715e67893d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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