11# sugguestion? report bugs?
22# go to https://github.com/chrisyue/vim-snippets/issues
33
4- snippet contr " symfony2 controller" b
4+ snippet contr " Symfony2 controller" b
55namespace `!p
66abspath = os.path.abspath(path)
77m = re.search(r ' [A-Z ]. + (?= /) ' , abspath)
@@ -25,19 +25,19 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
2525}
2626endsnippet
2727
28- snippet act " symfony2 action" b
28+ snippet act " Symfony2 action" b
2929/**
3030 * @Route("${3} ", name="${4} ")
3131 * @Method({${5: "POST" } })
32+ * @Template()
3233 */
3334public function ${1} Action(${2} )
3435{
3536 ${6}
36- return $this->redirect($this->generateUrl('home', [], false));
3737}
3838endsnippet
3939
40- snippet actt " symfony2 action and template" b
40+ snippet actt " Symfony2 action and template" b
4141/**
4242 * @Route("${3} ", name="${4} ")
4343 * @Method({${5: "GET" } })
@@ -51,7 +51,7 @@ public function ${1}Action(${2})
5151abspath = os.path.abspath(path) `
5252endsnippet
5353
54- snippet comm " symfony2 command" b
54+ snippet comm " Symfony2 command" b
5555namespace `!p
5656abspath = os.path.abspath(path)
5757m = re.search(r ' [A-Z ]. + (?= /) ' , abspath)
@@ -74,14 +74,12 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
7474{
7575 protected function configure()
7676 {
77- $this
78- ->setName('${1} ')
77+ $this->setName('${1} ')
7978 ->setDescription('${2} ')
8079 ->setDefinition([
8180 new InputArgument('', InputArgument::REQUIRED, ''),
8281 new InputOption('', null, InputOption::VALUE_NONE, ''),
83- ])
84- ;
82+ ]);
8583 }
8684
8785 protected function execute(InputInterface $input, OutputInterface $output)
@@ -90,7 +88,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
9088}
9189endsnippet
9290
93- snippet subs " symfony2 subscriber" b
91+ snippet subs " Symfony2 subscriber" b
9492namespace `!p
9593abspath = os.path.abspath(path)
9694m = re.search(r ' [A-Z ]. + (?= /) ' , abspath)
@@ -121,7 +119,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
121119}
122120endsnippet
123121
124- snippet transf " symfony2 form data transformer" b
122+ snippet transf " Symfony2 form data transformer" b
125123namespace `!p
126124abspath = os.path.abspath(path)
127125m = re.search(r ' [A-Z ]. + (?= /) ' , abspath)
@@ -155,7 +153,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
155153}
156154endsnippet
157155
158- snippet ent " symfony2 doctrine entity" b
156+ snippet ent " Symfony2 doctrine entity" b
159157namespace `!p
160158abspath = os.path.abspath(path)
161159m = re.search(r ' [A-Z ]. + (?= /) ' , abspath)
@@ -192,7 +190,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
192190}
193191endsnippet
194192
195- snippet form " symfony2 form type" b
193+ snippet form " Symfony2 form type" b
196194namespace `!p
197195abspath = os.path.abspath(path)
198196m = re.search(r ' [A-Z ]. + (?= /) ' , abspath)
@@ -235,3 +233,27 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
235233 }
236234}
237235endsnippet
236+
237+ snippet ev " Symfony2 event" b
238+ namespace `!p
239+ abspath = os.path.abspath(path)
240+ m = re.search(r ' [A-Z ]. + (?= /) ' , abspath)
241+ if m:
242+ snip.rv = m.group().replace(' /' , ' \\ ' )
243+ ` ;
244+
245+ use Symfony\C omponent\E ventDispatcher\E vent;
246+
247+ /**
248+ * ${2: @author `whoami` }
249+ */
250+ class `!p
251+ snip.rv = re.match(r ' . * (?= \. ) ' , fn).group()
252+ ` extends Event
253+ {
254+ }
255+ endsnippet
256+
257+ snippet redir " Symfony2 redirect"
258+ $this->redirect($this->generateUrl('${1} ', ${2} ));
259+ endsnippet
0 commit comments