Below is the current __toString method of SQLBase, when calling this however from a subclass, we can't access this result, since we return the protected variable $query instead of the public query() method.

/**
   * Prints the query string when the object is used as a string.
   *
   * @return string
   *   The query string.
   */
  public function __toString() {
    return (string) $this->query;
  }

Patch is simpler of issue description ;-)

CommentFileSizeAuthor
#2 2660464-query-method.patch545 bytesmallezie

Comments

mallezie created an issue. See original summary.

mallezie’s picture

Status: Active » Needs review
StatusFileSize
new545 bytes

And a patch.

mikeryan’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -migrate

Slight misdiagnosis, but the patch is good. The reason returning the member variable doesn't work in the UI is that it's not set in that case - it's only set when actually running a migration process. Returning $this->query() is correct for retrieving the query in all contexts.

catch’s picture

Version: 8.1.x-dev » 8.0.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!

  • catch committed a19c7b6 on
    Issue #2660464 by mallezie: Migrate sql base toString method not...

  • catch committed 738c78b on
    Issue #2660464 by mallezie: Migrate sql base toString method not...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.