snippet pf "Create a public function" b
public function $1()
{
return $this;
}
endsnippet
snippet ppf "Create a private function" b
public function $1()
{
return $this;
}
endsnippet
snippet ptf "Create a protected function" b
public function $1()
{
return $this;
}
endsnippet
snippet php
endsnippet
snippet gs "Getter and setter"
public function set${1/\w+\s*/\u$0/g}(\$$1)
{
$this->$1 = \$$1;
return \$this;
}
public function get${1/\w+\s*/\u$0/g}()
{
return \$this->$1;
}
endsnippet
snippet sf2:a "Create a symfony2 controller function" b
/**
* @param $request
* @return \Symfony\Bundle\FrameworkBundle\Controller\Response
*/
public function $1Action(Request $request)
{
if ($response = $this->handleNodeSecurity()) {
return $response;
}
return $this->defaultRender();
}
endsnippet
snippet page "Create trinity page"
configuration
->setDefaultController('FooBundle:MyController:bob')
->setDefaultControllerClass('Foo\Bundle\BarBundle\Controller\MyController::bobAction')
->setBlock('title', 'Trinity\Bundle\ContentManagerBundle\Form\Type\BlockType')
->setBlock('content', 'Trinity\Bundle\ContentManagerBundle\Form\Type\TinymceAdvancedBlockType');
}
public function getBlockTitle()
{
return $this->getBlock('title');
}
public function setBlockTitle(Block $block)
{
return $this->setBlock($block);
}
public function getBlockContent()
{
return $this->getBlock('content');
}
public function setBlockContent(Block $block)
{
return $this->setBlock($block);
}
}
endsnippet
snippet command "Create sf2 command"
setName('$1')
->setDescription('$2')
// ->addArgument('foo', InputArgument::OPTIONAL, '')
// ->addOption('bar', null, InputOption::VALUE_NONE, '')
->setHelp("The %command.name% $3");
}
protected function execute(InputInterface $input, OutputInterface $output)
{
// $this->getContainer()->get('foo.bar');
// $output->writeln(sprintf('%s bar.', $example));
// $input->getArgument('foo');
// $input->getOption('bar');
}
}
endsnippet
snippet controller "Create trinity controller"
handleNodeSecurity()) {
return $response;
}
return $this->defaultRender();
}
}
endsnippet
snippet form "Create sf2 form"
'',
);
public function buildForm(FormBuilderInterface $builder, array $options)
{
}
}
endsnippet
snippet array "Create array"
array($1)
endsnippet
snippet foreach "foreach"
foreach (\$${1}s as \$$1) {
}
endsnippet