Creates the object from the given DBAL connection parameters.

@param mixed[] $params
352858
public static function fromConnectionParameters(array $params) : self
    {
        if (! empty($params['connectstring'])) {
            return new self($params['connectstring']);
        }

        if (empty($params['host'])) {
            return new self($params['dbname'] ?? '');
        }

        $connectData = [];

        if (isset($params['servicename']) || isset($params['dbname'])) {
            $serviceKey = 'SID';

            if (! empty($params['service'])) {
                $serviceKey = 'SERVICE_NAME';
            }

            $serviceName = $params['servicename'] ?? $params['dbname'];

            $connectData[$serviceKey] = $serviceName;
        }

        if (! empty($params['instancename'])) {
            $connectData['INSTANCE_NAME'] = $params['instancename'];
        }

        if (! empty($params['pooled'])) {
            $connectData['SERVER'] = 'POOLED';
        }

        return self::fromArray([
            'DESCRIPTION' => [
                'ADDRESS' => [
                    'PROTOCOL' => 'TCP',
                    'HOST' => $params['host'],
                    'PORT' => $params['port'] ?? 1521,
                ],
                'CONNECT_DATA' => $connectData,
            ],
        ]);
    }
220522
public function buildQuery(array $params = [])
    {
        $params = array_merge($params, [
          'user_login' => $this->login,
          'api_key' => $this->apiKey
        ]);
        return http_build_query($params);
    }
1371738
public function initialize(array $params)
    {
        $this->params = $params;
        switch ($params['type']) {
            case self::TYPE_PROCESS:
                $this->establishProcessConnection();
                break;
            case self::TYPE_SOCKET:
            default:
                $this->establishSocketConnection();
                break;
        }
    }
1113532
public static function create(array $aParams = null)
    {
        $params = new self();
        if ($aParams === null) {
            return $params;
        }

        foreach ($aParams as $name => $value) {
            $params->$name = $value;
        }

        return $params;
    }
513141
public function parseParams(\stdClass $params): array
	{
		$params->type = strtolower($params->type);
		$dbtype = ($params->type !== 'postgresql') ? $params->type : 'pgsql';
		$dbtype = ucfirst($dbtype);

		// Make sure the class exists
		if ( ! class_exists("\\Query\\Drivers\\{$dbtype}\\Driver"))
		{
			throw new BadDBDriverException('Database driver does not exist, or is not supported');
		}

		// Set additional PDO options
		$options = [];

		if (isset($params->options))
		{
			$options = (array) $params->options;
		}

		// Create the dsn for the database to connect to
		if(strtolower($dbtype) === 'sqlite')
		{
			$dsn = $params->file;
		}
		else
		{
			$dsn = $this->createDsn($dbtype, $params);
		}


		return [$dsn, $dbtype, $params, $options];
	}
1320992
public function create(array $params = [])
    {
        return $this->executeRequest(
            RequestMethodEnum::POST,
            ResourceMethodEnum::CREATE,
            $params,
            null
        );
    }
620476
private function constructPdoDsn(array $params)
    {
        $dsn = 'oci:dbname=' . $this->getEasyConnectString($params);

        if (isset($params['charset'])) {
            $dsn .= ';charset=' . $params['charset'];
        }

        return $dsn;
    }
217552
public function init(array $params = array())
    {
        // Store this module as ancestor
        self::$ancestors[$this->id] = &$this;

        // If we are not authorized
        if (!$this->authorized) {
            // TODO: Remove session dependency as storage can be different
            // Search for user in session
            $pointer = &$_SESSION[$this->identifier()];
            if (isset($pointer)) {
                // Load user from session
                $this->user = unserialize($pointer);

                $this->update($this->user);
            }
        }

        // TODO: Should be removed in next majot version
        // If external init handler is set
        if (is_callable($this->initHandler)) {
            // Call external handler and pass reference on this object
            call_user_func_array($this->initHandler, array(&$this));
        }

        // New approach instead of old handler
        //Event::fire(self::EVENT_INIT_END, array(&$this));

        return parent::init($params);
    }
1045775
public static function create($params, $opts = null)
    {
        $type = Util\Util::classType($params['type']);
        $url = self::classUrl() . "/$type";
        list($resp, $usedOpts) = self::request(self::METHOD_POST, $url, $params, $opts);
        return Util\Util::arrayToObject($resp, $usedOpts);
    }
663388
public function createAndFilterSqlParts( $params )
    {
        $returnArray = array( 'tables' => '', 'joins'  => '', 'columns' => '' );

        if ( !isset( $params['tag_id'] ) )
            return $returnArray;

        if ( is_array( $params['tag_id'] ) )
        {
            $tagIDsArray = $params['tag_id'];
        }
        else if ( (int) $params['tag_id'] > 0 )
        {
            $tagIDsArray = array( (int) $params['tag_id'] );
        }
        else
        {
            return $returnArray;
        }

        if ( !isset( $params['include_synonyms'] ) || ( isset( $params['include_synonyms'] ) && (bool) $params['include_synonyms'] == true ) )
        {
            /** @var eZTagsObject[] $tags */
            $tags = eZTagsObject::fetchList( array( 'main_tag_id' => array( $tagIDsArray ) ) );
            if ( is_array( $tags ) )
            {
                foreach ( $tags as $tag )
                {
                    $tagIDsArray[] = $tag->attribute( 'id' );
                }
            }
        }

        $returnArray['tables'] = " INNER JOIN eztags_attribute_link i1 ON (i1.object_id = ezcontentobject.id AND i1.objectattribute_version = ezcontentobject.current_version)
                                   INNER JOIN eztags i2 ON (i1.keyword_id = i2.id)
                                   INNER JOIN eztags_keyword i3 ON (i2.id = i3.keyword_id)";

        $dbStrings = array();
        foreach ( $tagIDsArray as $tagID )
        {
            if ( is_numeric( $tagID ) )
            {
                $dbStrings[] = "EXISTS (
                    SELECT 1
                    FROM
                        eztags_attribute_link j1,
                        ezcontentobject j2
                    WHERE j1.keyword_id = " . (int) $tagID .
                    " AND j1.object_id = j2.id
                    AND j2.id = ezcontentobject.id
                    AND j1.objectattribute_version = j2.current_version
                )";
            }
        }

        $dbString = implode( " AND ", $dbStrings );

        if ( isset( $params['language'] ) )
        {
            $language = $params['language'];
            if ( !is_array( $language ) )
                $language = array( $language );

            eZContentLanguage::setPrioritizedLanguages( $language );
        }

        $returnArray['joins'] = " $dbString
                                  AND " . eZContentLanguage::languagesSQLFilter( 'i2' ) . " AND " .
                                  eZContentLanguage::sqlFilter( 'i3', 'i2' ) . " AND ";

        if ( isset( $params['language'] ) )
            eZContentLanguage::clearPrioritizedLanguages();

        return $returnArray;
    }
304095
public function instantiateEntity($params)
    {

        // Modify params so the class builder knows what was included via with()
        $params->_with = $this->with;

        $params->_fields = $this->fields;

        // Instantiate new entity class
        return new $this->class($params);

    }
1270889
private function buildParams($params)
    {
        $keys = is_array($params) ? $params : func_get_args();

        $array = [];

        foreach ($keys as $key) {
            if (property_exists($this, $key))
                $array = array_merge($array, [$key => $this->$key]);
        }

        return $array;
    }
762752
private function _constructPdoDsn(array $params)
    {
        $dsn = 'pgsql:';

        if (isset($params['host']) && $params['host'] !== '') {
            $dsn .= 'host=' . $params['host'] . ';';
        }

        if (isset($params['port']) && $params['port'] !== '') {
            $dsn .= 'port=' . $params['port'] . ';';
        }

        if (isset($params['dbname'])) {
            $dsn .= 'dbname=' . $params['dbname'] . ';';
        } elseif (isset($params['default_dbname'])) {
            $dsn .= 'dbname=' . $params['default_dbname'] . ';';
        } else {
            // Used for temporary connections to allow operations like dropping the database currently connected to.
            // Connecting without an explicit database does not work, therefore "postgres" database is used
            // as it is mostly present in every server setup.
            $dsn .= 'dbname=postgres;';
        }

        if (isset($params['sslmode'])) {
            $dsn .= 'sslmode=' . $params['sslmode'] . ';';
        }

        if (isset($params['sslrootcert'])) {
            $dsn .= 'sslrootcert=' . $params['sslrootcert'] . ';';
        }

        if (isset($params['sslcert'])) {
            $dsn .= 'sslcert=' . $params['sslcert'] . ';';
        }

        if (isset($params['sslkey'])) {
            $dsn .= 'sslkey=' . $params['sslkey'] . ';';
        }

        if (isset($params['sslcrl'])) {
            $dsn .= 'sslcrl=' . $params['sslcrl'] . ';';
        }

        if (isset($params['application_name'])) {
            $dsn .= 'application_name=' . $params['application_name'] . ';';
        }

        return $dsn;
    }
560905
public function create($params = array()) {
        $this->checkPermissions('create');
        
        return $this->client->createData($this->resourceName, $params);
    }
1151066
public function execute($params = [])
    {
        return $this->getDb()
            ->createCommand()
            ->setText($this->buildSql())
            ->execute(array_merge($this->getParams(), $params));
    }
51167
public function call($params)
    {
        //Prevent user forgetting connect with the ERP.
        $this->autoConnect();

        $args = array_merge(
            [$this->db, $this->uid, $this->password],
            func_get_args()
        );

        return collect(call_user_func_array([$this->object,'execute_kw'], $args));
    }
564072
private function _constructPdoDsn(array $params)
    {
        $dsn = 'mysql:';
        if (isset($params['host']) && $params['host'] != '') {
            $dsn .= 'host=' . $params['host'] . ';';
        }
        if (isset($params['port'])) {
            $dsn .= 'port=' . $params['port'] . ';';
        }
        if (isset($params['database'])) {
            $dsn .= 'dbname=' . $params['database'] . ';';
        }
        if (isset($params['unix_socket'])) {
            $dsn .= 'unix_socket=' . $params['unix_socket'] . ';';
        }
        if (isset($params['character_set'])) {
            // Let's use the new character_set parameter
            $charset = $params['character_set'];
        } elseif (isset($params['charset'])) {
            // Let's use the old charset parameter
            $charset = $params['charset'];
        } else {
            $charset = null;
        }
        if ($charset !== null) {
            $dsn .= 'charset=' . $charset . ';';
        }

        return $dsn;
    }