public function setAttribute ($attribute, $value) {
        // @see https://github.com/gajus/doll/issues/16
        if ($attribute === \PDO::ATTR_ERRMODE) {
            throw new Exception\InvalidArgumentException('Doll does not allow to change PDO::ATTR_ERRMODE.');
        }

        // @see
        if ($attribute === \PDO::ATTR_STATEMENT_CLASS) {
            throw new Exception\InvalidArgumentException('Doll does not allow to change PDO::ATTR_STATEMENT_CLASS.');
        }

        if ($attribute === \Gajus\Doll\PDO::ATTR_INFERRED_TYPE_HINTING) {
            $this->custom_attributes[$attribute] = !!$value;

            return;
        }

        if ($attribute === \Gajus\Doll\PDO::ATTR_LOGGING) {
            if ($this->isConnected()) {
                throw new Exception\RuntimeException('Cannot change Gajus\Doll\PDO::ATTR_LOGGING value after connection is established.');
            }

            $this->custom_attributes[$attribute] = !!$value;

            return;
        }

        if (!$this->isConnected()) {
            $this->attributes[$attribute] = $value;
        } else {
            parent::setAttribute($attribute, $value);
        }
    }
public function setAttribute ($attribute, $value) {
        // @see https://github.com/gajus/doll/issues/16
        if ($attribute === \PDO::ATTR_ERRMODE) {
            throw new Exception\InvalidArgumentException('Doll does not allow to change PDO::ATTR_ERRMODE.');
        }

        // @see
        if ($attribute === \PDO::ATTR_STATEMENT_CLASS) {
            throw new Exception\InvalidArgumentException('Doll does not allow to change PDO::ATTR_STATEMENT_CLASS.');
        }

        if ($attribute === \Gajus\Doll\PDO::ATTR_INFERRED_TYPE_HINTING) {
            $this->custom_attributes[$attribute] = !!$value;

            return;
        }

        if ($attribute === \Gajus\Doll\PDO::ATTR_LOGGING) {
            if ($this->isConnected()) {
                throw new Exception\RuntimeException('Cannot change Gajus\Doll\PDO::ATTR_LOGGING value after connection is established.');
            }

            $this->custom_attributes[$attribute] = !!$value;

            return;
        }

        if (!$this->isConnected()) {
            $this->attributes[$attribute] = $value;
        } else {
            parent::setAttribute($attribute, $value);
        }
    }
public function setAttribute ( $ attribute , $ value ) { // @see https://github.com/gajus/doll/issues/16 if ( $ attribute === \ PDO :: ATTR_ERRMODE ) { throw new Exception \ InvalidArgumentException ( 'Doll does not allow to change PDO::ATTR_ERRMODE.' ) ; } // @see if ( $ attribute === \ PDO :: ATTR_STATEMENT_CLASS ) { throw new Exception \ InvalidArgumentException ( 'Doll does not allow to change PDO::ATTR_STATEMENT_CLASS.' ) ; } if ( $ attribute === \ Gajus \ Doll \ PDO :: ATTR_INFERRED_TYPE_HINTING ) { $ this -> custom_attributes [ $ attribute ] = ! ! $ value ; return ; } if ( $ attribute === \ Gajus \ Doll \ PDO :: ATTR_LOGGING ) { if ( $ this -> isConnected ( ) ) { throw new Exception \ RuntimeException ( 'Cannot change Gajus\Doll\PDO::ATTR_LOGGING value after connection is established.' ) ; } $ this -> custom_attributes [ $ attribute ] = ! ! $ value ; return ; } if ( ! $ this -> isConnected ( ) ) { $ this -> attributes [ $ attribute ] = $ value ; } else { parent :: setAttribute ( $ attribute , $ value ) ; } }
When setAttribute is used prior to connecting to the database, the attribute is logged.
When setAttribute is used after connecting to the database, the attribute is applied.
The logged attributes are automatically applied after connecting to the database.

@param string $attribute
@param mixed $value
When setAttribute is used prior to connecting to the database the attribute is logged . When setAttribute is used after connecting to the database the attribute is applied . The logged attributes are automatically applied after connecting to the database .