AddActionRoute
extends sfRoute
in package
Route class for "add" actions (/term/add, /accession/add, etc.)
Rejects URL generation when an existing resource is referenced. The "add" route is for creating NEW resources only. When the caller passes a resource object ($params[0]) or an explicit slug, they want to view/edit an existing resource — not create a new one. Without this guard, /term/add matches any params with module=term because extra params become query strings, stealing URLs from the catch-all /:slug route and /:slug/edit route.
Table of Contents
Methods
- __construct() : mixed
- generate() : string
- Generate a URL from route parameters.
- getDefaults() : array<string|int, mixed>
- Get route defaults.
- getObject() : object|null
- Get a specific route object (used by action->getRoute()->getObject()).
- getOptions() : array<string|int, mixed>
- Get route options.
- getParameters() : array<string|int, mixed>
- Get route parameters (matched values).
- getPattern() : string
- Get the route pattern.
- getRequirements() : array<string|int, mixed>
- Get route requirements.
- matches() : bool
- Check if the route matches a URL.
- matchesParameters() : mixed
Methods
__construct()
public
__construct([string $pattern = '' ][, array<string|int, mixed> $defaults = [] ][, array<string|int, mixed> $requirements = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $pattern : string = ''
- $defaults : array<string|int, mixed> = []
- $requirements : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
generate()
Generate a URL from route parameters.
public
generate(array<string|int, mixed> $params[, bool $absolute = false ]) : string
Parameters
- $params : array<string|int, mixed>
- $absolute : bool = false
Return values
stringgetDefaults()
Get route defaults.
public
getDefaults() : array<string|int, mixed>
Return values
array<string|int, mixed>getObject()
Get a specific route object (used by action->getRoute()->getObject()).
public
getObject() : object|null
Return values
object|nullgetOptions()
Get route options.
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getParameters()
Get route parameters (matched values).
public
getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>getPattern()
Get the route pattern.
public
getPattern() : string
Return values
stringgetRequirements()
Get route requirements.
public
getRequirements() : array<string|int, mixed>
Return values
array<string|int, mixed>matches()
Check if the route matches a URL.
public
matches(string $url[, array<string|int, mixed> $context = [] ]) : bool
Parameters
- $url : string
- $context : array<string|int, mixed> = []
Return values
boolmatchesParameters()
public
matchesParameters(mixed $params[, mixed $context = [] ]) : mixed
Parameters
- $params : mixed
- $context : mixed = []