sfDoctrineRecord::setDefaultCulture PHP Method

setDefaultCulture() public static method

Sets the default culture
public static setDefaultCulture ( string $culture )
$culture string
    public static function setDefaultCulture($culture)
    {
        self::$_defaultCulture = $culture;
    }

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::setDefaultCulture