public postConnect ( Doctrine\DBAL\Event\ConnectionEventArgs $args ) | ||
$args | Doctrine\DBAL\Event\ConnectionEventArgs |
public function postConnect(ConnectionEventArgs $args)
{
if ($this->postConnectCalled) {
// Allows multiple postConnect calls for the same connection
// instance. This is done by MasterSlaveConnection for example when
// switching master/slave connections.
if ($this->connection === $args->getConnection()) {
return;
}
throw new \LogicException(sprintf('It looks like you have registered the %s to more than one connection. Please register one instance per connection.', get_class($this)));
}
$this->connection = $args->getConnection();
$this->schemaManager = new SchemaManager($this->connection);
$this->postConnectCalled = true;
if (!Type::hasType('geometry')) {
Type::addType('geometry', 'Jsor\\Doctrine\\PostGIS\\Types\\GeometryType');
}
if (!Type::hasType('geography')) {
Type::addType('geography', 'Jsor\\Doctrine\\PostGIS\\Types\\GeographyType');
}
if (!Type::hasType('raster')) {
Type::addType('raster', 'Jsor\\Doctrine\\PostGIS\\Types\\RasterType');
}
}