当前位置: 首页>>代码示例>>PHP>>正文


PHP sfDoctrineRecord::getDefaultCulture方法代码示例

本文整理汇总了PHP中sfDoctrineRecord::getDefaultCulture方法的典型用法代码示例。如果您正苦于以下问题:PHP sfDoctrineRecord::getDefaultCulture方法的具体用法?PHP sfDoctrineRecord::getDefaultCulture怎么用?PHP sfDoctrineRecord::getDefaultCulture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfDoctrineRecord的用法示例。


在下文中一共展示了sfDoctrineRecord::getDefaultCulture方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDocument

 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;
 }
开发者ID:rande,项目名称:sfSolrPlugin,代码行数:25,代码来源:sfLuceneDoctrineIndexer.class.php

示例2: executeTemplate

 public function executeTemplate(sfWebRequest $request)
 {
     $this->name = $request->getParameter('name', '');
     if ('' !== $this->name) {
         $this->forward404Unless(in_array($this->name, $this->generateMailTemplateNames($this->config)));
     }
     $obj = Doctrine::getTable('NotificationMail')->findOneByName($this->name);
     if (!$obj) {
         $obj = Doctrine::getTable('NotificationMail')->create(array('name' => $this->name));
     }
     $translation = $obj->Translation[sfDoctrineRecord::getDefaultCulture()];
     $this->form = new NotificationMailTranslationForm($translation);
     $this->form->updateDefaultsByConfig($this->getMailConfiguration($this->config, $this->name));
     if ($this->request->isMethod(sfWebRequest::POST)) {
         $this->form->bind($request->getParameter('notification_mail_translation'));
         if ($this->form->isValid()) {
             if (!$this->form->getObject()->exists()) {
                 if ($this->form->getObject()->id instanceof Doctrine_Record) {
                     $this->form->getObject()->id->save();
                 }
             }
             $this->form->save();
             $this->getUser()->setFlash('notice', 'Saved.');
             $this->redirect('@mail_template_specified?name=' . $this->name);
         }
         $this->getUser()->setFlash('error', (string) $this->form->getErrorSchema());
     }
 }
开发者ID:niryuu,项目名称:OpenPNE3,代码行数:28,代码来源:actions.class.php

示例3: updateDatabase

 /**
  * Update changed documentation pages in database
  */
 protected function updateDatabase($branch)
 {
     $types = dmDb::query('Doc d')->select('d.type')->distinct()->fetchFlat();
     $cultures = sfConfig::get('dm_i18n_cultures');
     $originalCulture = sfDoctrineRecord::getDefaultCulture();
     foreach ($types as $type) {
         foreach ($cultures as $culture) {
             sfDoctrineRecord::setDefaultCulture($culture);
             $dir = dmOs::join($this->repo->getDir(), $type, $culture);
             $files = sfFinder::type('file')->name('/^\\d{2}\\s-\\s.+\\.markdown$/')->in($dir);
             foreach ($files as $file) {
                 $docName = preg_replace('/^\\d{2}\\s-\\s(.+)\\.markdown$/', '$1', basename($file));
                 $docRecord = dmDb::query('DocPage dp')->withI18n()->innerJoin('dp.Doc doc')->innerJoin('doc.Branch branch')->where('branch.number = ?', $branch)->andWhere('doc.type = ?', $type)->andWhere('dpTranslation.name = ?', $docName)->fetchOne();
                 if ($docRecord) {
                     $docText = file_get_contents($file);
                     if ($docRecord->text != $docText) {
                         $docRecord->text = $docText;
                         $docRecord->save();
                     }
                 }
             }
         }
     }
     sfDoctrineRecord::setDefaultCulture($originalCulture);
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:28,代码来源:gitDocumentationSynchronizer.php

示例4: filterGet

 /**
  * Call get on Translation relationship.
  *
  * Allow access to I18n properties from the main object.
  *
  * @param Doctrine_Record $record
  * @param string          $name   Name of the property
  */
 public function filterGet(Doctrine_Record $record, $name)
 {
     $culture = sfDoctrineRecord::getDefaultCulture();
     if (isset($record['Translation'][$culture]) && '' != $record['Translation'][$culture][$name]) {
         return $record['Translation'][$culture][$name];
     }
     $defaultCulture = sfConfig::get('sf_default_culture');
     return $record['Translation'][$defaultCulture][$name];
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:17,代码来源:sfDoctrineRecordI18nFilter.class.php

示例5: withI18n

 /**
  * Добавить JOIN к таблице переводов
  *
  * @param  string         $alias - алиас к таблице, которую надо перевести
  * @return Doctrine_Query
  */
 public function withI18n($alias = null)
 {
     if (null === $alias) {
         $alias = $this->getRootAlias();
     }
     $transAlias = $this->getTransAlias($alias);
     //$this->innerJoin("{$alias}.Translation {$transAlias} WITH {$transAlias}.lang = ?",
     $this->leftJoin("{$alias}.Translation {$transAlias} WITH {$transAlias}.lang = ?", sfDoctrineRecord::getDefaultCulture());
     return $this;
 }
开发者ID:pycmam,项目名称:sf-project-template,代码行数:16,代码来源:myQuery.php

示例6: fetchTemplate

 public function fetchTemplate($templateName)
 {
     $object = $this->findOneByName($templateName);
     if (!($object && $object->getTemplate())) {
         if (($sample = $this->fetchTemplateFromConfigSample($templateName)) && $sample[1]) {
             $object = new NotificationMail();
             $object->Translation[sfDoctrineRecord::getDefaultCulture()]->title = $sample[0];
             $object->Translation[sfDoctrineRecord::getDefaultCulture()]->template = $sample[1];
         }
     }
     return $object;
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:12,代码来源:NotificationMailTable.class.php

示例7: withI18n

 /**
  * Добавить JOIN к таблице переводов
  *
  * @param  Doctrine_Query $q
  * @param  string         $rootAlias - алиас к таблице, которую надо перевести
  * @return Doctrine_Query
  */
 public function withI18n(Doctrine_Query $q = null, $rootAlias = null)
 {
     if (!$q) {
         $q = $this->createQuery($rootAlias);
     }
     if (!$rootAlias) {
         $rootAlias = $q->getRootAlias();
     }
     $transAlias = $this->getTranslationQueryAlias($rootAlias);
     $q->leftJoin("{$rootAlias}.Translation {$transAlias} WITH {$transAlias}.lang = ?", sfDoctrineRecord::getDefaultCulture());
     return $q;
 }
开发者ID:pycmam,项目名称:neskuchaik.ru,代码行数:19,代码来源:myBaseTable.php

示例8: filterGet

 /**
  * Implementation of filterGet() to call get on Translation relationship to allow
  * access to I18n properties from the main object.
  *
  * @param Doctrine_Record $record
  * @param string $name Name of the property
  * @param string $value Value of the property
  * @return void
  */
 public function filterGet(Doctrine_Record $record, $name)
 {
     return $record['Translation'][sfDoctrineRecord::getDefaultCulture()][$name];
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:13,代码来源:sfDoctrineRecordI18nFilter.class.php

示例9: configure

 /**
  * @param  string $name        The element name
  * @param  string $value       The date displayed in this widget
  * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
  * @param  array  $errors      An array of errors for the field
  *
  * @return string An HTML tag string
  *
  * @see sfWidgetForm
  */
 protected function configure($options = array(), $attributes = array())
 {
     $options['culture'] = isset($options['culture']) ? $options['culture'] : sfDoctrineRecord::getDefaultCulture();
     parent::configure($options, $attributes);
     $this->setOption('culture', $options['culture']);
 }
开发者ID:eXtreme,项目名称:diem,代码行数:16,代码来源:sfWidgetFormDmDate.class.php


注:本文中的sfDoctrineRecord::getDefaultCulture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。