mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Repository: allow not to provide a datasource for all tables
refs #13034
This commit is contained in:
parent
e5b24eb467
commit
38602379be
@ -214,9 +214,10 @@ abstract class Repository implements Selectable
|
|||||||
/**
|
/**
|
||||||
* Create a new repository object
|
* Create a new repository object
|
||||||
*
|
*
|
||||||
* @param Selectable $ds The datasource to use
|
* @param Selectable|null $ds The datasource to use.
|
||||||
|
* Only pass null if you have overridden {@link getDataSource()}!
|
||||||
*/
|
*/
|
||||||
public function __construct(Selectable $ds)
|
public function __construct(Selectable $ds = null)
|
||||||
{
|
{
|
||||||
$this->ds = $ds;
|
$this->ds = $ds;
|
||||||
$this->aliasTableMap = array();
|
$this->aliasTableMap = array();
|
||||||
@ -271,6 +272,9 @@ abstract class Repository implements Selectable
|
|||||||
*/
|
*/
|
||||||
public function getDataSource($table = null)
|
public function getDataSource($table = null)
|
||||||
{
|
{
|
||||||
|
if ($this->ds === null) {
|
||||||
|
throw new ProgrammingError('No data source available');
|
||||||
|
}
|
||||||
return $this->ds;
|
return $this->ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user