Jarves\Configuration\Connection::getType PHP Method

getType() public method

public getType ( ) : string
return string
    public function getType()
    {
        return $this->type === 'postgresql' ? 'pgsql' : $this->type;
    }

Usage Example

Exemplo n.º 1
0
    /**
     * @param Connection $connection
     * @param Connection[] $slaves
     *
     * @return string
     */
    public function getConnectionYml(Connection $connection, $slaves)
    {
        $dsn = $connection->getDsn();
        $user = var_export($connection->getUsername(), true);
        $password = var_export($connection->getPassword(), true);
        $dsn = var_export($dsn, true);
        $adapter = strtolower($connection->getType());
        $persistent = $connection->getPersistent() ? 'true' : 'false';
        foreach ($slaves as $slave) {
            $slaves .= '
          - dsn: ' . $slave->getDsn(true);
        }
        $slaves = '';
        $yml = <<<EOF
default:
        adapter: {$adapter}
        classname: \\Propel\\Runtime\\Connection\\PropelPDO
        dsn: {$dsn}
        user: {$user}
        password: {$password}
        options:
          ATTR_PERSISTENT: {$persistent}
        attributes:
          ATTR_EMULATE_PREPARES: true
        settings:
          charset: utf8
        slaves:
          {$slaves}
EOF;
        return $yml;
    }