Skip to content

Commit

Permalink
Added user-friendly error message for missing getList method
Browse files Browse the repository at this point in the history
  • Loading branch information
sleeping-owl committed Oct 15, 2014
1 parent db3ac04 commit e1b890c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/SleepingOwl/Admin/Models/Form/FormItem/MultiSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function render()
$list = array_combine($list, $list);
} else
{
if ( ! method_exists($this->list, 'getList'))
{
throw new \Exception('You must implement "public static function getList()" in "' . $this->list . '"');
}
$list = forward_static_call([
$this->list,
'getList'
Expand Down
4 changes: 4 additions & 0 deletions src/SleepingOwl/Admin/Models/Form/FormItem/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public function render()
$list = array_combine($list, $list);
} else
{
if ( ! method_exists($this->list, 'getList'))
{
throw new \Exception('You must implement "public static function getList()" in "' . $this->list . '"');
}
$list = forward_static_call([
$this->list,
'getList'
Expand Down

0 comments on commit e1b890c

Please sign in to comment.