protected function buildQuery( QuoteInterface $db, $filterComponents )
    {

        // primary keys
        $filterTags = array();
        $dataTypes = $this->dataTypesGet();

        // have we got components that we can't handle
        if( $dataTypesMissing = array_diff( array_keys( $filterComponents ), array_keys( $dataTypes ) ) ) {
            throw new \LogicException(
                sprintf(
                    "The following keys `%s` don't exist in %s. You can't find a entity with this.",
                    implode(',', $dataTypesMissing ),
                    $this->table
                )
            );
        }

        // add the datatype tag to the filter component
        foreach( $filterComponents as $name => $component ) {
            $component->tag = $dataTypes[$name]->toQueryTag();
        }

        $data = array();

        # system column tableoid can tell us which table a row comes from
        # http://www.postgresql.org/docs/9.1/static/ddl-inherit.html
        $sql = sprintf(
            "SELECT * FROM ONLY %s %s",
            $db->quoteIdent( $this->table ),
            $this->buildQueryWhereClause( $db, $filterComponents, $data )
        );

        $query = new Query( $sql, $data );

        return $query;

    }
protected function buildQuery( QuoteInterface $db, $filterComponents )
    {

        // primary keys
        $filterTags = array();
        $dataTypes = $this->dataTypesGet();

        // have we got components that we can't handle
        if( $dataTypesMissing = array_diff( array_keys( $filterComponents ), array_keys( $dataTypes ) ) ) {
            throw new \LogicException(
                sprintf(
                    "The following keys `%s` don't exist in %s. You can't find a entity with this.",
                    implode(',', $dataTypesMissing ),
                    $this->table
                )
            );
        }

        // add the datatype tag to the filter component
        foreach( $filterComponents as $name => $component ) {
            $component->tag = $dataTypes[$name]->toQueryTag();
        }

        $data = array();

        # system column tableoid can tell us which table a row comes from
        # http://www.postgresql.org/docs/9.1/static/ddl-inherit.html
        $sql = sprintf(
            "SELECT * FROM ONLY %s %s",
            $db->quoteIdent( $this->table ),
            $this->buildQueryWhereClause( $db, $filterComponents, $data )
        );

        $query = new Query( $sql, $data );

        return $query;

    }
protected function buildQuery ( QuoteInterface $ db , $ filterComponents ) { // primary keys $ filterTags = array ( ) ; $ dataTypes = $ this -> dataTypesGet ( ) ; // have we got components that we can't handle if ( $ dataTypesMissing = array_diff ( array_keys ( $ filterComponents ) , array_keys ( $ dataTypes ) ) ) { throw new \ LogicException ( sprintf ( "The following keys `%s` don't exist in %s. You can't find a entity with this." , implode ( ',' , $ dataTypesMissing ) , $ this -> table ) ) ; } // add the datatype tag to the filter component foreach ( $ filterComponents as $ name => $ component ) { $ component -> tag = $ dataTypes [ $ name ] -> toQueryTag ( ) ; } $ data = array ( ) ; # system column tableoid can tell us which table a row comes from # http://www.postgresql.org/docs/9.1/static/ddl-inherit.html $ sql = sprintf ( "SELECT * FROM ONLY %s %s" , $ db -> quoteIdent ( $ this -> table ) , $ this -> buildQueryWhereClause ( $ db , $ filterComponents , $ data ) ) ; $ query = new Query ( $ sql , $ data ) ; return $ query ; }
Build a Query object
@param array $filterComponents
@return Bond\Pg\Query
Build a Query object