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
1 changed files with 3 additions and 2 deletions

View File

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