/** * Return the record filter for this table. * It will automatically add a relation filter if relationAutoSetting is true, and it can determine an appropriate * filter. */ function sourceFilter() { $sourceFilter = parent::sourceFilter(); if ($this->relationAutoSetting && $this->getParentClass() && ($filterKey = $this->getParentIdName($this->getParentClass(), $this->sourceClass())) && ($filterValue = $this->sourceID())) { $newFilter = "`{$filterKey}` = '" . Convert::raw2sql($filterValue) . "'"; if ($sourceFilter && is_array($sourceFilter)) { // Note that the brackets below are taken into account when building this $sourceFilter = implode(") AND (", $sourceFilter); } $sourceFilter = $sourceFilter ? "({$sourceFilter}) AND ({$newFilter})" : $newFilter; } return $sourceFilter; }