Spot\Mapper::connection PHP Method

connection() public method

Get connection to use
public connection ( string $connectionName = null ) : Doctrine\DBAL\Connection
$connectionName string Named connection or entity class name
return Doctrine\DBAL\Connection
    public function connection($connectionName = null)
    {
        // Try getting connection based on given name
        if ($connectionName === null) {
            return $this->config()->defaultConnection();
        } elseif ($connection = $this->config()->connection($connectionName)) {
            return $connection;
        } elseif ($connection = $this->config()->defaultConnection()) {
            return $connection;
        }
        throw new Exception("Connection '" . $connectionName . "' does not exist. Please setup connection using Spot\\Config::addConnection().");
    }

Usage Example

Example #1
0
 /**
  * Escape/quote identifier
  *
  * @param string $identifier
  * @return string
  */
 public function escapeIdentifier($identifier)
 {
     if ($this->_noQuote) {
         return $identifier;
     }
     return $this->mapper->connection()->quoteIdentifier(trim($identifier));
 }
All Usage Examples Of Spot\Mapper::connection