This commit is contained in:
Alessandro Ferro 2022-07-30 18:49:31 +02:00
parent 7b481afe26
commit 927250f83f
2 changed files with 6 additions and 10 deletions

View File

@ -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:
<img src="/examples/images/breadcrumb.jpg" alt="Demo">

View File

@ -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]);