@@ 44-89 (lines=46) @@ | ||
41 | * |
|
42 | * @return ArrayNodeDefinition |
|
43 | */ |
|
44 | protected function getUnderscoredBundlePrefixDefinition() |
|
45 | { |
|
46 | $node = new ArrayNodeDefinition('underscored_bundle_prefix'); |
|
47 | ||
48 | $node |
|
49 | ->addDefaultsIfNotSet() |
|
50 | ->children() |
|
51 | ->enumNode('case') |
|
52 | ->info('Which case to use, lowercase or uppercase. Default is lowercase.') |
|
53 | ->values(array('lowercase', 'uppercase')) |
|
54 | ->defaultValue('lowercase') |
|
55 | ->end() |
|
56 | ->booleanNode('join_table_field_suffix') |
|
57 | ->defaultTrue() |
|
58 | ->info('Join table will get field name suffix enabling you to have multiple many-to-many relations without stating explicitly table names.') |
|
59 | ->end() |
|
60 | ->arrayNode('map') |
|
61 | ->info('Map of short bundle names and prefixes, if you do not want to use full bundle name in prefix. Useful when bundle name is too long, considering that, per example, MySQL has 60 chars table name limit.') |
|
62 | ->useAttributeAsKey('bundle') |
|
63 | ->prototype('scalar')->end() |
|
64 | ->end() |
|
65 | ->arrayNode('whitelist') |
|
66 | ->beforeNormalization() |
|
67 | ->ifString() |
|
68 | ->then(function ($value) { |
|
69 | return [$value]; |
|
70 | }) |
|
71 | ->end() |
|
72 | ->info('Define for which bundles to apply prefixes.') |
|
73 | ->prototype('scalar')->end() |
|
74 | ->end() |
|
75 | ->arrayNode('blacklist') |
|
76 | ->beforeNormalization() |
|
77 | ->ifString() |
|
78 | ->then(function ($value) { |
|
79 | return [$value]; |
|
80 | }) |
|
81 | ->end() |
|
82 | ->info('Define for which bundles not to apply prefixes.') |
|
83 | ->prototype('scalar')->end() |
|
84 | ->end() |
|
85 | ->end() |
|
86 | ->end(); |
|
87 | ||
88 | return $node; |
|
89 | } |
|
90 | ||
91 | /** |
|
92 | * Configure underscored class namespace prefix naming strategy |
|
@@ 96-142 (lines=47) @@ | ||
93 | * |
|
94 | * @return ArrayNodeDefinition |
|
95 | */ |
|
96 | protected function getUnderscoredClassNamespacePrefixDefinition() |
|
97 | { |
|
98 | $node = new ArrayNodeDefinition('underscored_class_namespace_prefix'); |
|
99 | ||
100 | $node |
|
101 | ->addDefaultsIfNotSet() |
|
102 | ->children() |
|
103 | ->enumNode('case') |
|
104 | ->info('Which case to use, lowercase or uppercase. Default is lowercase.') |
|
105 | ->values(array('lowercase', 'uppercase')) |
|
106 | ->defaultValue('lowercase') |
|
107 | ->end() |
|
108 | ->booleanNode('join_table_field_suffix') |
|
109 | ->defaultTrue() |
|
110 | ->info('Join table will get field name suffix enabling you to have multiple many-to-many relations without stating explicitly table names.') |
|
111 | ->end() |
|
112 | ->arrayNode('map') |
|
113 | ->requiresAtLeastOneElement() |
|
114 | ->info('Map of FQCNs prefixes and table prefixes to use for naming.') |
|
115 | ->useAttributeAsKey('namespace') |
|
116 | ->prototype('scalar')->end() |
|
117 | ->end() |
|
118 | ->arrayNode('whitelist') |
|
119 | ->beforeNormalization() |
|
120 | ->ifString() |
|
121 | ->then(function ($value) { |
|
122 | return [$value]; |
|
123 | }) |
|
124 | ->end() |
|
125 | ->info('Define for which FQCNs prefixes table prefixes should be applied.') |
|
126 | ->prototype('scalar')->end() |
|
127 | ->end() |
|
128 | ->arrayNode('blacklist') |
|
129 | ->beforeNormalization() |
|
130 | ->ifString() |
|
131 | ->then(function ($value) { |
|
132 | return [$value]; |
|
133 | }) |
|
134 | ->end() |
|
135 | ->info('Define for which FQCNs prefixes not to apply table prefixes.') |
|
136 | ->prototype('scalar')->end() |
|
137 | ->end() |
|
138 | ->end() |
|
139 | ->end(); |
|
140 | ||
141 | return $node; |
|
142 | } |
|
143 | ||
144 | /** |
|
145 | * Configure namer collection |