Browse Source

added constraints check for dbo deserialization

develop
Robin Thoni 8 years ago
parent
commit
01948a6ecb
2 changed files with 6 additions and 2 deletions
  1. 4
    0
      src/Utils/Controller/LuRoute.php
  2. 2
    2
      src/Utils/Dbo/LuDbo.php

+ 4
- 0
src/Utils/Controller/LuRoute.php View File

184
             {
184
             {
185
                 throw $e;
185
                 throw $e;
186
             }
186
             }
187
+            catch (LuDboConstraintException $e)
188
+            {
189
+                throw $e;
190
+            }
187
             catch (\Exception $e)
191
             catch (\Exception $e)
188
             {
192
             {
189
                 throw new LuBusinessException("Unable to parse JSON value for '" . $param->getName() . "'", 400, $e);
193
                 throw new LuBusinessException("Unable to parse JSON value for '" . $param->getName() . "'", 400, $e);

+ 2
- 2
src/Utils/Dbo/LuDbo.php View File

131
             $value = null;
131
             $value = null;
132
             if (isset($json[$name])) {
132
             if (isset($json[$name])) {
133
                 $value = static::deserializeValue($json[$name], $type);
133
                 $value = static::deserializeValue($json[$name], $type);
134
-                $property->setAccessible(true);
135
-                $property->setValue($dbo, $value);
136
             }
134
             }
137
 
135
 
138
             if ($doc->isNotNull() && is_null($value)) {
136
             if ($doc->isNotNull() && is_null($value)) {
144
                     call_user_func_array([$value, $constraint->getMethod()], $constraint->getArguments());
142
                     call_user_func_array([$value, $constraint->getMethod()], $constraint->getArguments());
145
                 }
143
                 }
146
             }
144
             }
145
+            $property->setAccessible(true);
146
+            $property->setValue($dbo, $value);
147
         }
147
         }
148
         return $dbo;
148
         return $dbo;
149
     }
149
     }

Loading…
Cancel
Save