private function buildQuery($sql, $arguments = null)
    {
        if (is_array($arguments)) {
            $finalArgs = array();
            foreach ($arguments as $field => $val) {
                // Parametrize the arguments
                $finalArgs[] = " {$field}=:{$field}";
            }

            // Join all the arguments as a string
            $finalArgs = implode(' AND', $finalArgs);

            if (strpos($sql, ' _arguments_')) {
                // Place the arguments string in the placeholder
                $sql = str_replace(' _arguments_', $finalArgs, $sql);
            } else {
                // Appends the parameters string the sql query
                // $sql .= $finalArgs; TODO: Watch this expression if it is on use
            }
        }

        //Replace the _table_ placeholder
        $sql = str_replace(' _table_', " {$this->tableName} ", $sql);

        return $sql;
    }
private function buildQuery($sql, $arguments = null)
    {
        if (is_array($arguments)) {
            $finalArgs = array();
            foreach ($arguments as $field => $val) {
                // Parametrize the arguments
                $finalArgs[] = " {$field}=:{$field}";
            }

            // Join all the arguments as a string
            $finalArgs = implode(' AND', $finalArgs);

            if (strpos($sql, ' _arguments_')) {
                // Place the arguments string in the placeholder
                $sql = str_replace(' _arguments_', $finalArgs, $sql);
            } else {
                // Appends the parameters string the sql query
                // $sql .= $finalArgs; TODO: Watch this expression if it is on use
            }
        }

        //Replace the _table_ placeholder
        $sql = str_replace(' _table_', " {$this->tableName} ", $sql);

        return $sql;
    }
private function buildQuery ( $ sql , $ arguments = null ) { if ( is_array ( $ arguments ) ) { $ finalArgs = array ( ) ; foreach ( $ arguments as $ field => $ val ) { // Parametrize the arguments $ finalArgs [ ] = " {$field}=:{$field}" ; } // Join all the arguments as a string $ finalArgs = implode ( ' AND' , $ finalArgs ) ; if ( strpos ( $ sql , ' _arguments_' ) ) { // Place the arguments string in the placeholder $ sql = str_replace ( ' _arguments_' , $ finalArgs , $ sql ) ; } else { // Appends the parameters string the sql query // $sql .= $finalArgs; TODO: Watch this expression if it is on use } } //Replace the _table_ placeholder $ sql = str_replace ( ' _table_' , " {$this->tableName} " , $ sql ) ; return $ sql ; }
Builds a query string with the passed arguments

@param string $sql
@param array  $arguments - Associative array of fields and values

@return string
Builds a query string with the passed arguments