mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-13 15:18:41 +00:00
Better default connection return
This commit is contained in:
parent
a1a7420654
commit
684d6369a8
|
|
@ -77,10 +77,14 @@ class DatabasePool
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function get(string $key = 'core') /* : ?ConnectionAbstract */
|
public function get(string $key = '') /* : ?ConnectionAbstract */
|
||||||
{
|
{
|
||||||
if (!isset($this->pool[$key])) {
|
if((!empty($key) && !isset($this->pool[$key])) || empty($this->pool)) {
|
||||||
return null; /* todo: return nullconnection */
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($key)) {
|
||||||
|
return reset($this->pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->pool[$key];
|
return $this->pool[$key];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user