public function __construct() { $this->_eventDispatcher = new DatabaseManager(); } } echo urlencode(serialize(new Swift_Transport_EsmtpTransport())); }
protected function makeConnection($name) { $config = $this->getConfig($name);//这里来的 // First we will check by the connection name to see if an extension has been // registered specifically for that connection. If it has we will call the // Closure and pass it the config allowing it to resolve the connection. if (isset($this->extensions[$name])) { return call_user_func($this->extensions[$name], $config, $name); } $driver = $config['driver']; // Next we will check to see if an extension has been registered for a driver // and will call the Closure if so, which allows us to have a more generic // resolver for the drivers themselves which applies to all connections. if (isset($this->extensions[$driver])) { return call_user_func($this->extensions[$driver], $config, $name); } return $this->factory->make($config, $name); }
是该类的getConfig方法来的,看一下这个方法。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
protectedfunctiongetConfig($name) {
$name = $name ?: $this->getDefaultConnection(); // To get the database connection configuration, we will just pull each of the // connection configurations and get the configurations for the given name. // If the configuration doesn't exist, we'll throw an exception and bail.