protected function getDefaultActions() { $actions = parent::getDefaultActions(); $actions[] = 'reedit'; $actions[] = 'renew'; return $actions; }
/** * Constructor. * * @param array $options An array of options */ public function __construct(array $options) { $options = array_merge(array( 'query_methods' => array('list' => null, 'object' => null), 'connection' => null, ), $options); parent::__construct($options); }
/** * Constructor. * * @param array $options An array of options */ public function __construct(array $options) { parent::__construct($options); if (!isset($this->options['model'])) { throw new InvalidArgumentException(sprintf('You must pass a "model" option to %s ("%s" route)', get_class($this), $this->options['name'])); } $this->options = array_merge(array('actions' => false, 'module' => $this->options['name'], 'prefix_path' => '/' . $this->options['name'], 'column' => isset($this->options['column']) ? $this->options['column'] : 'id', 'model_methods' => array(), 'with_wildcard_routes' => false), $this->options); $this->options['requirements'] = array_merge(array($this->options['column'] => '\\d+'), $this->options['requirements']); $this->options['model_methods'] = array_merge(array('list' => null, 'object' => null), $this->options['model_methods']); if (isset($this->options['route_class'])) { $this->routeClass = $this->options['route_class']; } $this->generateRoutes(); }
{ if ($route->matchesUrl($url, array('method' => 'post'))) { $match = $name; break; } } $t->is($match, 'test_collection', '->generateRoutes() orders routes so URLs generated by the wildcard collection route are matched by that route'); // collection_actions $t->diag('collection_actions'); $collection = new sfObjectRouteCollection(array( 'name' => 'test', 'model' => 'TestModel', 'with_wildcard_routes' => true, 'collection_actions' => array('export' => array('post')), 'default_params' => array('foo' => 'bar'), )); $routes = $collection->getRoutes(); $t->isa_ok($routes['test_export'], 'sfObjectRoute', '->generateRoutes() generates custom collection routes'); $url = $routes['test_export']->generate(array()); $t->isa_ok($routes['test_export']->matchesUrl($url, array('method' => 'post')), 'array', '->generateRoutes() creates a collection action route that matches a URL it generates'); $match = null; foreach ($routes as $name => $route) { if ($route->matchesUrl($url, array('method' => 'post'))) {
/** * DOCUMENT ME * @param array $options */ public function __construct(array $options) { // Prefix path is always empty since the engine page already brought us here $options['prefix_path'] = ''; parent::__construct($options); }