FIX augmentLoadLazyFields doesn't work with renamed tables

On a project I renamed the table BlogPosts to News_Posts which led to a broken join clause.
This commit is contained in:
wernerkrauss 2020-08-25 16:29:19 +02:00 committed by Werner M. Krauß
parent 92eb4f5da0
commit dd8ce8b8dd

View File

@ -57,9 +57,10 @@ class BlogPostFilter extends DataExtension
*/ */
public function augmentLoadLazyFields(SQLSelect &$query, DataQuery &$dataQuery = null, $dataObject) public function augmentLoadLazyFields(SQLSelect &$query, DataQuery &$dataQuery = null, $dataObject)
{ {
$blogPostTable = DataObject::getSchema()->tableName(BlogPost::class);
$dataQuery->innerJoin( $dataQuery->innerJoin(
DataObject::getSchema()->tableName(BlogPost::class), $blogPostTable,
'"SiteTree"."ID" = "BlogPost"."ID"' '"SiteTree"."ID" = "' . $blogPostTable . '"."ID"'
); );
} }
} }