@@ -55,34 +55,27 @@ public function convertAsForm(string $options, string $formType): string
5555 $ options = preg_replace ("/'__php\((.+?)\)'/i " , $ matches [1 ], $ options );
5656 }
5757
58- // Query builder: remove quotes around closure
59- // Should we really check formType or can we just
60- // look for query_builder option?
61- if (preg_match ("/EntityType$/i " , $ formType )) {
62- preg_match ("/'query_builder' => '(.+?)}',/i " , $ options , $ matches );
63-
64- if (count ($ matches ) > 0 ) {
65- $ options = str_replace ("'query_builder' => ' $ matches [1 ]}' " , "'query_builder' => " .stripslashes ($ matches [1 ]).'} ' , $ options );
66- }
67- preg_match ("/'query_builder' => '(.+?)',/i " , $ options , $ matches );
58+ // Query builder: remove quotes around closure (for 'query_builder' and 'query' arguments of all forms)
59+ preg_match ("/'query_builder' => '(.+?)}',/i " , $ options , $ matches );
6860
69- if (count ($ matches ) > 0 ) {
70- $ options = str_replace ("'query_builder' => ' $ matches [1 ]' " , "'query_builder' => " .stripslashes ($ matches [1 ]), $ options );
71- }
61+ if (count ($ matches ) > 0 ) {
62+ $ options = str_replace ("'query_builder' => ' $ matches [1 ]}' " , "'query_builder' => " .stripslashes ($ matches [1 ]).'} ' , $ options );
7263 }
64+ preg_match ("/'query_builder' => '(.+?)',/i " , $ options , $ matches );
7365
74- // Same question here
75- if ( preg_match ( " /ModelType$/i " , $ formType )) {
76- preg_match ( " /'query' => '(.+?)}',/i " , $ options , $ matches );
66+ if ( count ( $ matches ) > 0 ) {
67+ $ options = str_replace ( " 'query_builder' => ' $ matches [ 1 ] ' " , " 'query_builder' => " . stripslashes ( $ matches [ 1 ]), $ options );
68+ }
7769
78- if (count ($ matches ) > 0 ) {
79- $ options = str_replace ("'query' => ' $ matches [1 ]}' " , "'query' => " .stripslashes ($ matches [1 ]).'} ' , $ options );
80- }
81- preg_match ("/'query' => '(.+?)',/i " , $ options , $ matches );
70+ preg_match ("/'query' => '(.+?)}',/i " , $ options , $ matches );
8271
83- if (count ($ matches ) > 0 ) {
84- $ options = str_replace ("'query' => ' $ matches [1 ]' " , "'query' => " .stripslashes ($ matches [1 ]), $ options );
85- }
72+ if (count ($ matches ) > 0 ) {
73+ $ options = str_replace ("'query' => ' $ matches [1 ]}' " , "'query' => " .stripslashes ($ matches [1 ]).'} ' , $ options );
74+ }
75+ preg_match ("/'query' => '(.+?)',/i " , $ options , $ matches );
76+
77+ if (count ($ matches ) > 0 ) {
78+ $ options = str_replace ("'query' => ' $ matches [1 ]' " , "'query' => " .stripslashes ($ matches [1 ]), $ options );
8679 }
8780
8881 return $ options ;
0 commit comments