public function getDbFormattedValue()
    {
        // SRM: This code finds the table where the field named $this->name lives
        // Todo: move to somewhere more appropriate, such as DataMapper, the magical class-to-be?

        if ($this->aggregate) {
            return intval($this->value);
        }

        /** @var DBField $dbField */
        $dbField = singleton($this->model)->dbObject($this->name);
        $dbField->setValue($this->value);
        return $dbField->RAW();
    }