Update SelectQuery interface to closely resemble core database API

Created on 19 May 2017, over 7 years ago
Updated 28 August 2024, 4 months ago

The current SelectQuery class only supports AND operator when creating the query string. Would be good to also allow the OR operator and it is also a very easy way to accomplish this.

📌 Task
Status

Closed: outdated

Version

4.0

Component

salesforce.module

Created by

🇸🇮Slovenia jzavrl

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States AaronBauman Philadelphia

    I'm doing some cleanup on unsupported branches.
    Please re-open this issue and update the version to 5.0.x-dev if this issue is still applicable to the latest release.

  • 🇺🇦Ukraine goodboy Kharkiv, Ukraine

    Hello, @aaronbauman
    We are going to extend Drupal\salesforce\SelectQuery by adding simple functions. This will allow us to create chains like

    $query
      ->fields(['field1', 'field2'])
      ->addCondition('status', 1)
      ->addOrder('DateCreated', 'DESC')
      ->limit(1);
    

    Does it make sense to propose these functions for inclusion in Drupal\salesforce\SelectQuery? If not, can we safely use our derived class with these functions?

    public function objectType($value) {
        $this->objectType = $value;
        return $this;
      }
    
      public function fields(array $fields) {
        $this->fields = $fields;
        return $this;
      }
    
      public function addField($field) {
        $this->fields[] = $field;
        return $this;
      }
    
      public function order(array $order) {
        $this->order = $order;
        return $this;
      }
    
      public function addOrder($field, $value = 'ASC') {
        $this->order[$field] = $value;
        return $this;
      }
    
      public function limit($value) {
        $this->limit = (int) $value;
        return $this;
      }
    
      public function offset($value) {
        $this->offset = (int) $value;
        return $this;
      }
    
Production build 0.71.5 2024