src/PostgreSQL.php
public function bindExecuteAndFetch($query, $parameters = [], $castModel = null)
    {
        $statement = $this->link->prepare($query);

        foreach ($parameters as $index => $paramProperties) {
            if (is_object($paramProperties)) {
                $paramProperties = (array) $paramProperties;
            }
            if (is_array($paramProperties)) {
                $statement->bindValue(
                    (int) $index + 1,
                    $paramProperties['value'],
                    $paramProperties['param']
                );
            } else {
                $statement->bindValue((int) $index + 1, $paramProperties);
            }
        }

        $statement->execute();
        $data = $statement->fetch(PDO::FETCH_ASSOC);
        $statement->closeCursor();

        return (
            $castModel && $data
            ? $data
            : $data
        );
    }
public function bindExecuteAndFetch($query, $parameters = [], $castModel = null)
    {
        $statement = $this->link->prepare($query);

        foreach ($parameters as $index => $paramProperties) {
            if (is_object($paramProperties)) {
                $paramProperties = (array) $paramProperties;
            }
            if (is_array($paramProperties)) {
                $statement->bindValue(
                    (int) $index + 1,
                    $paramProperties['value'],
                    $paramProperties['param']
                );
            } else {
                $statement->bindValue((int) $index + 1, $paramProperties);
            }
        }

        $statement->execute();
        $data = $statement->fetch(PDO::FETCH_ASSOC);
        $statement->closeCursor();

        return (
            $castModel && $data
            ? $data
            : $data
        );
    }
public function bindExecuteAndFetch ( $ query , $ parameters = [ ] , $ castModel = null ) { $ statement = $ this -> link -> prepare ( $ query ) ; foreach ( $ parameters as $ index => $ paramProperties ) { if ( is_object ( $ paramProperties ) ) { $ paramProperties = ( array ) $ paramProperties ; } if ( is_array ( $ paramProperties ) ) { $ statement -> bindValue ( ( int ) $ index + 1 , $ paramProperties [ 'value' ] , $ paramProperties [ 'param' ] ) ; } else { $ statement -> bindValue ( ( int ) $ index + 1 , $ paramProperties ) ; } } $ statement -> execute ( ) ; $ data = $ statement -> fetch ( PDO :: FETCH_ASSOC ) ; $ statement -> closeCursor ( ) ; return ( $ castModel && $ data ? $ data : $ data ) ; }
Bind Execute a query and fetch first row as associative array

@param  string $query Query string
@param  array  $parameters Query parameters
@return array
@throws \Phramework\Exceptions\DatabaseException
Bind Execute a query and fetch first row as associative array