1
votes

My model is built on non-numerical ID's (36-char. GUID to be specific).

The problem is that when I run symfony 1.4 admin generator, it assumes that all my IDs are numeric and applies default routing requirements.

I tried providing specific routing requirements as advised here: http://www.codemassacre.com/2009/04/27/symfony-12-admin-with-custom-primary-key/ In my case the snippet from routing.yml is:

organization:
  class: sfPropelRouteCollection
  options:
    model:                Organization
    module:               account
    prefix_path:          /account
    column:               id
    with_wildcard_routes: true
  requirements:
    id: \w+

However, I am still getting 404 errors indicating that my route wasn't matched. The URL I am matching is "/account/8985329a-fd3b-41a0-b27b-f45c80d51765/edit". It looks like my requirement for the given route is being ignored.

I could create my routes manually but I'd rather not.

2

2 Answers

4
votes

Because \w doesn't match - character.

So you have to replace \w+ with, say, [\w-]+ or [\da-f-]+ (more strict regexp)

1
votes

[\w-]+ did not work for me, but '[\w-]+' did (symfony 1.4.10).

I think symfony/php was interpreting the [] syntax as an array specification.