@@ -103,17 +103,6 @@ protected function parseNode(RouteCollection $collection, \DOMElement $node, $pa
103103 */
104104 protected function parseRoute (RouteCollection $ collection , \DOMElement $ node , $ path )
105105 {
106- foreach ($ node ->childNodes as $ child ) {
107- if ($ child instanceof \DOMElement && $ child ->tagName === 'option ' ) {
108- $ option = $ node ->ownerDocument ->createElementNs (
109- self ::NAMESPACE_URI ,
110- 'option ' ,
111- $ child ->nodeValue
112- );
113- $ option ->setAttribute ('key ' , $ child ->getAttribute ('key ' ));
114- $ node ->appendChild ($ option );
115- }
116- }
117106
118107 // the Symfony Routing component uses a path attribute since Symfony 2.2
119108 // instead of the deprecated pattern attribute0
@@ -162,9 +151,33 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p
162151 $ node ->appendChild ($ defaultFormatNode );
163152 }
164153
154+ $ options = $ this ->getOptions ($ node );
155+
156+ foreach ($ options as $ option ) {
157+ $ node ->appendChild ($ option );
158+ }
159+
165160 parent ::parseRoute ($ collection , $ node , $ path );
166161 }
167162
163+ private function getOptions (\DOMElement $ node )
164+ {
165+ $ options = array ();
166+ foreach ($ node ->childNodes as $ child ) {
167+ if ($ child instanceof \DOMElement && $ child ->tagName === 'option ' ) {
168+ $ option = $ node ->ownerDocument ->createElementNs (
169+ self ::NAMESPACE_URI ,
170+ 'option ' ,
171+ $ child ->nodeValue
172+ );
173+ $ option ->setAttribute ('key ' , $ child ->getAttribute ('key ' ));
174+ $ options [] = $ option ;
175+ }
176+ }
177+
178+ return $ options ;
179+ }
180+
168181 /**
169182 * {@inheritDoc}
170183 */
0 commit comments