浏览代码

Fixed fatal error with ListMapper::get

Fabien Pennequin 14 年之前
父节点
当前提交
e40f42dc38
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      Datagrid/ListCollection.php

+ 9 - 1
Datagrid/ListCollection.php

@@ -32,5 +32,13 @@ class ListCollection
     {
         return array_key_exists($name, $this->elements);
     }
-    
+
+    public function get($name)
+    {
+        if ($this->has($name)) {
+            return $this->elements[$name];
+        }
+
+        throw new \InvalidArgumentException(sprintf('Element "%s" does not exist.', $name));
+    }
 }