1
1
# sugguestion? report bugs?
2
2
# go to https://github.com/chrisyue/vim-snippets/issues
3
+
3
4
snippet contr " symfony2 controller" b
4
5
namespace `!p
5
6
abspath = os.path.abspath(path)
@@ -15,7 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
15
16
use Symfony\C omponent\H ttpFoundation\R equest;
16
17
17
18
/**
18
- * ${1: @author `whoami` } ${2}
19
+ * ${1: @author `whoami` }
19
20
*/
20
21
class `!p
21
22
snip.rv = re.match(r ' . * (?= \. ) ' , fn).group()
@@ -65,7 +66,7 @@ use Symfony\Component\Console\Input\InputInterface;
65
66
use Symfony\C omponent\C onsole\O utput\O utputInterface;
66
67
67
68
/**
68
- * ${3: @author `whoami` } ${4}
69
+ * ${3: @author `whoami` }
69
70
*/
70
71
class `!p
71
72
snip.rv = re.match(r ' . * (?= \. ) ' , fn).group()
@@ -100,7 +101,7 @@ if m:
100
101
use Symfony\C omponent\E ventDispatcher\E ventSubscriberInterface;
101
102
102
103
/**
103
- * ${1: @author `whoami` } ${2}
104
+ * ${1: @author `whoami` }
104
105
*/
105
106
class `!p
106
107
snip.rv = re.match(r ' . * (?= \. ) ' , fn).group()
@@ -132,7 +133,7 @@ use Symfony\Component\Form\DataTransformerInterface;
132
133
use Symfony\C omponent\F orm\E xception\T ransformationFailedException;
133
134
134
135
/**
135
- * ${3: @author `whoami` } ${4}
136
+ * ${3: @author `whoami` }
136
137
*/
137
138
class `!p
138
139
snip.rv = re.match(r ' . * (?= \. ) ' , fn).group()
@@ -165,7 +166,7 @@ if m:
165
166
use Doctrine\O RM\M apping as ORM;
166
167
167
168
/**
168
- * ${3: @author `whoami` } ${4}
169
+ * ${3: @author `whoami` }
169
170
*
170
171
* @ORM\E ntity()
171
172
* @ORM\T able(name="`!p snip.rv = re.match(r ' . * (?= \. ) ' , fn).group().lower() ` ")
@@ -182,3 +183,47 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
182
183
private $id;
183
184
}
184
185
endsnippet
186
+
187
+ snippet form " symfony2 form type" b
188
+ namespace `!p
189
+ abspath = os.path.abspath(path)
190
+ m = re.search(r ' [A-Z ]. + (?= /) ' , abspath)
191
+ if m:
192
+ snip.rv = m.group().replace(' /' , ' \\ ' )
193
+ ` ;
194
+
195
+ use Symfony\C omponent\F orm\A bstractType;
196
+ use Symfony\C omponent\F orm\F ormBuilderInterface;
197
+ use Symfony\C omponent\O ptionsResolver\O ptionsResolverInterface;
198
+
199
+ /**
200
+ * ${2: @author `whoami` }
201
+ */
202
+ class `!p
203
+ snip.rv = re.match(r ' . * (?= \. ) ' , fn).group()
204
+ ` extends AbstractType
205
+ {
206
+ /**
207
+ * {@inheritDoc}
208
+ */
209
+ public function buildForm(FormBuilderInterface $builder, array $options)
210
+ {
211
+ }
212
+
213
+ /**
214
+ * {@inheritDoc}
215
+ */
216
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
217
+ {
218
+ $resolver->setDefaults();
219
+ }
220
+
221
+ /**
222
+ * {@inheritDoc}
223
+ */
224
+ public function getName()
225
+ {
226
+ return '${1} ';
227
+ }
228
+ }
229
+ endsnippet
0 commit comments