PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / trunk
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution vtrunk
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
← All changes | vendor/wpfluent/framework/src/WPFluent/Database/ConnectionResolver.php +4 -3 1.5.21trunk View file →
@@ -1,8 +1,9 @@
1 1 <?php
2 2
3 3 namespace FluentBooking\Framework\Database;
4 4
5 +use InvalidArgumentException;
5 6 use FluentBooking\Framework\Foundation\App;
6 7 use FluentBooking\Framework\Database\ConnectionResolverInterface;
7 8
8 9 class ConnectionResolver implements ConnectionResolverInterface
@@ -46,9 +47,9 @@
46 47 return $name;
47 48 }
48 49
49 50 if (is_null($name)) {
50 - return $this->getDefaultConnection();
51 + $name = $this->getDefaultConnection();
51 52 }
52 53
53 54 if (isset($this->connections[$name])) {
54 55 return $this->connections[$name];
@@ -53,9 +54,9 @@
53 54 if (isset($this->connections[$name])) {
54 55 return $this->connections[$name];
55 56 }
56 57
57 - return $this->getDefaultConnection();
58 + throw new InvalidArgumentException("Connection [{$name}] not found.");
58 59 }
59 60
60 61 /**
61 62 * Add a connection to the resolver.
@@ -86,9 +87,9 @@
86 87 * @return string
87 88 */
88 89 public function getDefaultConnection()
89 90 {
90 - return $this->default ?: App::getInstance('db');
91 + return $this->default;
91 92 }
92 93
93 94 /**
94 95 * Set the default connection name.