sfDoctrineRecord::getDefaultCulture PHP Method

getDefaultCulture() public static method

Return the default culture
public static getDefaultCulture ( ) : string
return string the default culture
    public static function getDefaultCulture()
    {
        if (!self::$_defaultCulture) {
            throw new sfException('The default culture has not been set');
        }
        return self::$_defaultCulture;
    }

Usage Example

 public function getDocument()
 {
     if (!$this->shouldIndex()) {
         $this->getSearch()->getEventDispatcher()->notify(new sfEvent($this, 'indexer.log', array('model "%s" cancelled indexation - primary key = %s', $this->getModelName(), current($this->getModel()->identifier()))));
         return false;
     }
     $old_culture = null;
     // automatic symfony i18n detection
     if ($this->getModel()->getTable()->hasRelation('Translation')) {
         $old_culture = sfDoctrineRecord::getDefaultCulture();
         sfDoctrineRecord::setDefaultCulture($this->getSearch()->getParameter('culture'));
     }
     // build document
     $doc = $this->getBaseDocument();
     $doc = $this->configureDocumentFields($doc);
     //$doc = $this->configureDocumentCategories($doc);
     $doc = $this->configureDocumentMetas($doc);
     // add document
     $doc->setField('sfl_guid', $this->getModelGuid());
     // restore culture in symfony i18n detection
     if ($old_culture) {
         sfDoctrineRecord::setDefaultCulture($old_culture);
     }
     return $doc;
 }
All Usage Examples Of sfDoctrineRecord::getDefaultCulture