| @@ 14-22 (lines=9) @@ | ||
| 11 | * @param object $instance The object to be populated with values |
|
| 12 | * @param array $parameters A key-value array, that will be matched to setters |
|
| 13 | */ |
|
| 14 | public function applyValues($instance, array $parameters) |
|
| 15 | { |
|
| 16 | foreach ((array) $parameters as $key => $value) { |
|
| 17 | $method = 'set' . str_replace('_', '', $key); |
|
| 18 | if (method_exists($instance, $method)) { |
|
| 19 | $instance->{$method}($value); |
|
| 20 | } |
|
| 21 | } |
|
| 22 | } |
|
| 23 | ||
| 24 | } |
|
| 25 | ||
| @@ 53-61 (lines=9) @@ | ||
| 50 | ||
| 51 | ||
| 52 | /** code that does the actualy population of data from the given array in blueprint */ |
|
| 53 | private function populateEntity($instance, $parameters) |
|
| 54 | { |
|
| 55 | foreach ((array) $parameters as $key => $value) { |
|
| 56 | $method = 'set' . str_replace('_', '', $key); |
|
| 57 | if (method_exists($instance, $method)) { |
|
| 58 | $instance->{$method}($value); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| 63 | ||
| 64 | /** |
|