/**
  * Constructor.
  *
  * @param string $pattern       The pattern to match
  * @param array  $defaults      An array of default parameter values
  * @param array  $requirements  An array of requirements for parameters (regexes)
  * @param array  $options       An array of options
  *
  * @see sfRoute
  */
 public function __construct($pattern, array $defaults = array(), array $requirements = array(), array $options = array())
 {
     if (!isset($options['model'])) {
         throw new InvalidArgumentException(sprintf('You must pass a "model" option for a %s object (%s).', get_class($this), $pattern));
     }
     if (!isset($options['type'])) {
         throw new InvalidArgumentException(sprintf('You must pass a "type" option for a %s object (%s).', get_class($this), $pattern));
     }
     if (!in_array($options['type'], array('object', 'list'))) {
         throw new InvalidArgumentException(sprintf('The "type" option can only be "object" or "list", "%s" given (%s).', $options['type'], $pattern));
     }
     parent::__construct($pattern, $defaults, $requirements, $options);
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param string $pattern       The pattern to match
  * @param array  $defaults      An array of default parameter values
  * @param array  $requirements  An array of requirements for parameters (regexes)
  * @param array  $options       An array of options
  *
  * @see sfObjectRoute
  */
 public function __construct($pattern, array $defaults = array(), array $requirements = array(), array $options = array())
 {
     parent::__construct($pattern, $defaults, $requirements, $options);
     $this->options['object_model'] = $this->options['model'];
 }