Skip to content

Commit 23da48a

Browse files
author
Jonas De Keukelaere
committed
Fix datagrid
1 parent 4ef02aa commit 23da48a

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

spoon/datagrid/datagrid.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,8 +1484,14 @@ public function setColumnFunction($function, $arguments = null, $columns = null,
14841484
// has results
14851485
if($this->source->getNumResults() > 0)
14861486
{
1487+
if (is_object($function)) {
1488+
if (!is_callable($function)) {
1489+
throw new SpoonDatagridException('The object "' . $function::class . '" is not callable.');
1490+
}
1491+
}
1492+
14871493
// regular function
1488-
if(!is_array($function))
1494+
else if(!is_array($function))
14891495
{
14901496
// function checks
14911497
if(!function_exists((string) $function)) throw new SpoonDatagridException('The function "' . (string) $function . '" doesn\'t exist.');
@@ -1841,8 +1847,14 @@ public function setRowFunction($function, $arguments = null, $overwrite = false)
18411847
// has results
18421848
if($this->source->getNumResults() > 0)
18431849
{
1850+
if (is_object($function)) {
1851+
if (!is_callable($function)) {
1852+
throw new SpoonDatagridException('The object "' . $function::class . '" is not callable.');
1853+
}
1854+
}
1855+
18441856
// regular function
1845-
if(!is_array($function))
1857+
else if(!is_array($function))
18461858
{
18471859
// function checks
18481860
if(!function_exists((string) $function)) throw new SpoonDatagridException('The function "' . (string) $function . '" doesn\'t exist.');

0 commit comments

Comments
 (0)