Update Table.php

This commit is contained in:
Alessandro Ferro 2022-07-27 09:40:24 +02:00
parent fcc6c153e8
commit 12c171577d
1 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* PhpXpress v1.0.1 * PhpXpress v1.0.2
* *
* @see https://github.com/xfarrow/phpxpress The PhpXpress GitHub project * @see https://github.com/xfarrow/phpxpress The PhpXpress GitHub project
* *
@ -11,7 +11,7 @@
* FITNESS FOR A PARTICULAR PURPOSE. * FITNESS FOR A PARTICULAR PURPOSE.
*/ */
namespace PhpXpress; namespace PhpXpress;
class Table{ class Table{
/* === Structure === */ /* === Structure === */
@ -150,8 +150,10 @@
* @return void * @return void
*/ */
function setDataSource(Array $dataSource){ function setDataSource(Array $dataSource){
if(empty($dataSource)) if(empty($dataSource)){
throw new InvalidArgumentException('Parameter cannot be empty.'); $this->dataSource = [];
return;
}
if(isset($this-> dataSource)) if(isset($this-> dataSource))
throw new BadFunctionCallException("Cannot add datasource to a Table already having a datasource"); throw new BadFunctionCallException("Cannot add datasource to a Table already having a datasource");