This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Tests/Resources/app/config Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Symfony \Cmf \Bundle \RoutingAutoBundle \AutoRoute \Adapter \AdapterInterface ;
6
6
use Metadata \MetadataFactoryInterface ;
7
+ use Symfony \Component \OptionsResolver \OptionsResolver ;
7
8
8
9
/**
9
10
* Class which handles URL generation and conflict resolution
@@ -45,7 +46,13 @@ public function generateUrl($document)
45
46
$ tokens = array ();
46
47
foreach ($ tokenProviderConfigs as $ name => $ options ) {
47
48
$ tokenProvider = $ this ->serviceRegistry ->getTokenProvider ($ options ['name ' ]);
48
- $ tokens ['{ ' . $ name . '} ' ] = $ tokenProvider ->provideValue ($ document , $ options );
49
+
50
+ // I can see the utility of making this a singleton, but it is a massive
51
+ // code smell to have this in a base class and be also part of the interface
52
+ $ optionsResolver = new OptionsResolver ();
53
+ $ tokenProvider ->configureOptions ($ optionsResolver );
54
+
55
+ $ tokens ['{ ' . $ name . '} ' ] = $ tokenProvider ->provideValue ($ document , $ optionsResolver ->resolve ($ options ['options ' ]));
49
56
}
50
57
51
58
$ urlSchema = $ metadata ->getUrlSchema ();
Original file line number Diff line number Diff line change 1
1
Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Resources\Document\Blog :
2
2
url_schema : /test/blog/{blog_title}
3
3
token_providers :
4
- blog_title : [ content_method, [ method: getTitle ] ]
4
+ blog_title : [content_method, { method: getTitle } ]
You can’t perform that action at this time.
0 commit comments