From 927250f83f426d0710a920855e28980a5afe8b63 Mon Sep 17 00:00:00 2001 From: Alessandro Ferro <> Date: Sat, 30 Jul 2022 18:49:31 +0200 Subject: [PATCH] bugfix --- README.md | 8 ++------ phpxpress/Table.php | 8 ++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 95025a8..83b52b3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # phpxpress -PhpXpress' goal is to create a simple way to programmatically manage Bootstrap elements. +PhpXpress' goal is to create a simple way to programmatically manage Bootstrap elements. It's similar to Microsoft's WebForms with a great layout by default (like DevExpress). @@ -21,7 +21,7 @@ The following code ``` $employees = array($employee1, $employee2, $employee3); -$table = new Table; +$table = new PhpXpress\Table; $table->setDataSource($employees); $table->setCustomCaptions(array("Name", "Surname", "Date of Birth", "Social Security Number")); //not required. If not specified it'll use objects' property names @@ -132,7 +132,3 @@ The follwing code Produces the following output: Demo - - - - diff --git a/phpxpress/Table.php b/phpxpress/Table.php index 26d8147..aa2d2e7 100644 --- a/phpxpress/Table.php +++ b/phpxpress/Table.php @@ -69,7 +69,7 @@ function draw(){ if(!isset($this->dataSource)){ - throw new BadFunctionCallException('Error: dataSource not set.'); + throw new BadFunctionCallException('Error: datasource not set.'); } $tableClass = "table"; @@ -227,7 +227,7 @@ function setCustomCaptions(Array $captions){ if(empty($this->dataSource)) - throw new BadFunctionCallException('Before setting Custom captions, a datasource must be provided first.'); + throw new BadFunctionCallException('Before setting Custom captions, a non empty datasource must be provided first.'); $provided = count($captions); $expected = count($this->columnCaptions); @@ -275,8 +275,8 @@ */ function invisible_column($column_name){ - if(!isset($this->dataSource)) - throw new BadFunctionCallException('Unable to call invisible_column() if the datasource is not set'); + if(!isset($this->dataSource) || empty($this->dataSource)) + throw new BadFunctionCallException('Unable to call invisible_column() if the datasource is not set or empty.'); if(is_array($this->dataSource[0])){ $array_keys = array_keys($this -> dataSource[0]);