src/Bond/Pg/Catalog.php
private function getEnum()
     {

        $enumResult = $this->db->query(
            new Raw( <<<SQL
                SELECT
                    t.typname as name,
                    n.nspname as schema,
                    array_agg( e.enumlabel ORDER BY e.enumsortorder ) as labels
                FROM
                    pg_enum e
                INNER JOIN
                    pg_type t ON e.enumtypid = t.oid
                INNER JOIN
                    pg_namespace n ON t.typnamespace = n.oid
                WHERE
                    n.nspname = ANY( current_schemas(false) )
                GROUP BY
                    t.typname, t.oid, n.nspname
                ORDER BY
                    schema, t.typname ASC
SQL
             )
        );

        $output = [];
        foreach( $enumResult->fetch(Result::FLATTEN_PREVENT | Result::TYPE_DETECT) as $data ) {
            $output[$data['name']] = $data['labels'];
        }

        return new Enum($output);

     }
private function getEnum()
     {

        $enumResult = $this->db->query(
            new Raw( <<<SQL
                SELECT
                    t.typname as name,
                    n.nspname as schema,
                    array_agg( e.enumlabel ORDER BY e.enumsortorder ) as labels
                FROM
                    pg_enum e
                INNER JOIN
                    pg_type t ON e.enumtypid = t.oid
                INNER JOIN
                    pg_namespace n ON t.typnamespace = n.oid
                WHERE
                    n.nspname = ANY( current_schemas(false) )
                GROUP BY
                    t.typname, t.oid, n.nspname
                ORDER BY
                    schema, t.typname ASC
SQL
             )
        );

        $output = [];
        foreach( $enumResult->fetch(Result::FLATTEN_PREVENT | Result::TYPE_DETECT) as $data ) {
            $output[$data['name']] = $data['labels'];
        }

        return new Enum($output);

     }
private function getEnum ( ) { $ enumResult = $ this -> db -> query ( new Raw (  <<<SQL
                SELECT
                    t.typname as name,
                    n.nspname as schema,
                    array_agg( e.enumlabel ORDER BY e.enumsortorder ) as labels
                FROM
                    pg_enum e
                INNER JOIN
                    pg_type t ON e.enumtypid = t.oid
                INNER JOIN
                    pg_namespace n ON t.typnamespace = n.oid
                WHERE
                    n.nspname = ANY( current_schemas(false) )
                GROUP BY
                    t.typname, t.oid, n.nspname
                ORDER BY
                    schema, t.typname ASC
SQL ) ) ; $ output = [ ] ; foreach ( $ enumResult -> fetch ( Result :: FLATTEN_PREVENT | Result :: TYPE_DETECT ) as $ data ) { $ output [ $ data [ 'name' ] ] = $ data [ 'labels' ] ; } return new Enum ( $ output ) ; }
Get array of enum's and their values from the database
@param Bond\Pg
@return array
Get array of enum s and their values from the database