瀏覽代碼

check for contraints before executing it

develop
Robin Thoni 8 年之前
父節點
當前提交
e6478d3a6d
共有 1 個檔案被更改,包括 4 行新增0 行删除
  1. 4
    0
      src/Utils/Dbo/LuDbo.php

+ 4
- 0
src/Utils/Dbo/LuDbo.php 查看文件

@@ -152,9 +152,13 @@ abstract class LuDbo implements \JsonSerializable {
152 152
 
153 153
     /**
154 154
      * @param $constraints LuParameterConstraintDbo[]
155
+     * @throws LuDboConstraintException
155 156
      */
156 157
     public function checkConstraints($constraints) {
157 158
         foreach ($constraints as $constraint) {
159
+            if (!is_callable([$this, $constraint->getMethod()])) {
160
+                throw new LuDboConstraintException("Constraint '" . $constraint->getMethod() . "' could not be found");
161
+            }
158 162
             call_user_func_array([$this, $constraint->getMethod()], $constraint->getArguments());
159 163
         }
160 164
     } 

Loading…
取消
儲存