Author: david.buchmann@liip.ch
Inheritance: extends Symfony\Component\Routing\Route, implements Symfony\Cmf\Component\Routing\RouteObjectInterface
コード例 #1
0
ファイル: Route.php プロジェクト: fredpeaks/RoutingBundle
 /**
  * {@inheritdoc}
  */
 protected function isBooleanOption($name)
 {
     return $name === 'add_trailing_slash' || parent::isBooleanOption($name);
 }
コード例 #2
0
 /**
  * Update the locale of a route if $id starts with the prefix and has a
  * valid locale right after.
  *
  * @param ModelRoute      $doc   The route object
  * @param string          $id    The id (in move case, this is not the current
  *                               id of $route).
  * @param DocumentManager $dm    The document manager to get locales from if
  *                               the setAvailableTranslations option is
  *                               enabled.
  * @param boolean         $force Whether to update the locale even if the
  *                               route already has a locale.
  */
 protected function updateLocale(ModelRoute $doc, $id, DocumentManager $dm, $force = false)
 {
     $matches = array();
     // only update if the prefix matches, to allow for more than one
     // listener and more than one route root.
     if (!preg_match('#(' . implode('|', $this->getPrefixes()) . ')/([^/]+)(/|$)#', $id, $matches)) {
         return;
     }
     if (in_array($locale = $matches[2], $this->locales)) {
         if ($force || !$doc->getDefault('_locale')) {
             $doc->setDefault('_locale', $locale);
         }
         if ($force || !$doc->getRequirement('_locale')) {
             $doc->setRequirement('_locale', $locale);
         }
     } else {
         if ($this->addLocalePattern) {
             $doc->setOption('add_locale_pattern', true);
         }
         if ($this->updateAvailableTranslations && $dm->isDocumentTranslatable($doc) && !$doc->getRequirement('_locale')) {
             $locales = $dm->getLocalesFor($doc, true);
             $doc->setRequirement('_locale', implode('|', $locales));
         }
     }
 }
コード例 #3
0
 /**
  * @inheritDoc
  */
 public function supportsRoute(Route $route)
 {
     return $route->getDefault('_controller') === $this->routeController && $route->getDefault('path') !== '';
 }
コード例 #4
0
ファイル: Route.php プロジェクト: superdesk/web-publisher
 /**
  * {@inheritdoc}
  */
 public function getId()
 {
     return parent::getId();
 }