public function getDefaultConnection() { $me = $this; Configurations::initialize(function ($config) use($me) { $me->default = $config->getDefaultConnection(); }); $connection = Connections::parseUrl($me->default); return $connection->database; }
/** * You cannot create an instance of Schema class * directly * * @param $model * @param \Cygnite\Helpers\Inflector $inflection */ private function __construct($model, Inflector $inflection) { $this->_pointer = $model; $this->inflector = $inflection; if (class_exists(get_class($this->_pointer))) { $reflectionClass = new \ReflectionClass(get_class($this->_pointer)); if (property_exists($this->_pointer, 'database')) { $reflectionProperty = $reflectionClass->getProperty('database'); $reflectionProperty->setAccessible(true); $this->database = $reflectionProperty->getValue($this->_pointer); } else { $this->database = Connections::getDefaultConnection(); } if (property_exists($this->_pointer, 'primaryKey')) { $reflectionPropertyKey = $reflectionClass->getProperty('primaryKey'); $reflectionPropertyKey->setAccessible(true); $this->primaryKey = $reflectionPropertyKey->getValue($this->_pointer); } $this->setConn($this->database); if (!property_exists($this->_pointer, 'tableName')) { $this->tableName = $this->inflector->tabilize(get_class($this->_pointer)); } } // $this->config = Connections::getConfiguration(); }