@@ 48-58 (lines=11) @@ | ||
45 | $objectSchema = $this->schema; |
|
46 | ||
47 | /** @var Schema $propertySchema */ |
|
48 | foreach ($objectSchema->getPropertySchemas() as $name => $propertySchema) { |
|
49 | if (!property_exists($input, $name)) { |
|
50 | if (!isset($this->defaults[$name])) { |
|
51 | continue; |
|
52 | } |
|
53 | $value = $this->defaults[$name]; |
|
54 | } else { |
|
55 | $value = $input->$name; |
|
56 | } |
|
57 | $output->$name = $this->hydrateProperty($name, $value); |
|
58 | } |
|
59 | ||
60 | foreach ($input as $name => $value) { |
|
61 | if (!isset($output->$name)) { |
@@ 34-41 (lines=8) @@ | ||
31 | * @var string $name |
|
32 | * @var Schema $propertySchema |
|
33 | */ |
|
34 | foreach ($objectSchema->getPropertySchemas() as $name => $propertySchema) { |
|
35 | if (!isset($input->$name) && isset($this->defaults[$name])) { |
|
36 | $value = $this->defaults[$name]; |
|
37 | } else { |
|
38 | $value = $input->$name; |
|
39 | } |
|
40 | $object->$name = $this->hydrateProperty($name, $value); |
|
41 | } |
|
42 | ||
43 | return $object; |
|
44 | } |