Formula = $formula; $this->RootID = $RootID; parent::__construct($loader, $formId, $queryFormatter); } public function CreateQueryBuilderInstance() { if($this->QueryBuilder != null) return $this->QueryBuilder; return new AggregationQueryBuilder($this->Loader, $this->Loader->RECORDS_TABLE, $this->RootID, [], $this->Formula); } public function GetQuery() { return $this->CreateQueryBuilder()->Execute(); } }