FIXED: Error where uninitialised Locale field would crash queries. This is noticeable during full text search, when full model fields might not be initialised.

This commit is contained in:
Damian Mooyman 2012-08-09 15:40:11 +12:00
parent 84f5956921
commit d846a72d39

View File

@ -539,7 +539,7 @@ class Translatable extends DataExtension implements PermissionProvider {
// If the record is saved (and not a singleton), and has a locale,
// limit the current call to its locale. This fixes a lot of problems
// with other extensions like Versioned
$locale = ($this->owner->ID && $this->owner->Locale) ? $this->owner->Locale : Translatable::get_current_locale();
$locale = ($this->owner->ID && !empty($this->owner->Locale)) ? $this->owner->Locale : Translatable::get_current_locale();
$baseTable = ClassInfo::baseDataClass($this->owner->class);
if(
$locale