2014-03-11 16:10:50 -04:00
|
|
|
# sugguestion? report bugs?
|
2013-11-16 14:45:48 -05:00
|
|
|
# go to https://github.com/chrisyue/vim-snippets/issues
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
priority -50
|
|
|
|
|
2014-07-02 07:18:18 -04:00
|
|
|
snippet classn "Basic class with namespace snippet" b
|
2016-05-14 07:57:54 -04:00
|
|
|
<?php
|
|
|
|
|
2014-07-02 07:18:18 -04:00
|
|
|
namespace `!p
|
2016-05-14 07:57:54 -04:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2014-07-02 07:18:18 -04:00
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
/**
|
2016-05-14 07:57:54 -04:00
|
|
|
* ${1:@author `!v g:snips_author`}
|
2014-07-02 07:18:18 -04:00
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
`$2
|
|
|
|
{
|
|
|
|
public function __construct(${3:$options})
|
|
|
|
{
|
|
|
|
${4:// code}
|
|
|
|
}$0
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-12-28 13:23:13 -05:00
|
|
|
snippet contr "Symfony2 controller" b
|
2016-05-14 07:57:54 -04:00
|
|
|
<?php
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
namespace `!p
|
2016-05-14 07:57:54 -04:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2013-08-03 08:50:12 -04:00
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
|
|
|
/**
|
2016-05-14 07:57:54 -04:00
|
|
|
* ${1:@author `!v g:snips_author`}
|
2013-08-03 08:50:12 -04:00
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` extends Controller
|
|
|
|
{
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2016-05-14 07:57:54 -04:00
|
|
|
snippet sfa "Symfony 2 Controller action"
|
|
|
|
/**
|
|
|
|
* @Route("/${1:route_name}", name="$1")
|
|
|
|
* @Template()
|
|
|
|
*/
|
|
|
|
public function $1Action($2)
|
|
|
|
{
|
|
|
|
$3
|
2016-11-09 12:22:55 -05:00
|
|
|
return ${4:[];}$0
|
2016-05-14 07:57:54 -04:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-12-28 13:23:13 -05:00
|
|
|
snippet act "Symfony2 action" b
|
2013-11-16 14:45:48 -05:00
|
|
|
/**
|
2017-08-03 11:21:37 -04:00
|
|
|
* @Route("$3", name="$4")
|
2013-11-16 14:45:48 -05:00
|
|
|
* @Method({${5:"POST"}})
|
2013-12-28 13:23:13 -05:00
|
|
|
* @Template()
|
2013-11-16 14:45:48 -05:00
|
|
|
*/
|
2017-08-03 11:21:37 -04:00
|
|
|
public function $1Action($2)
|
2013-11-16 14:45:48 -05:00
|
|
|
{
|
2017-08-03 11:21:37 -04:00
|
|
|
$6
|
2013-11-16 14:45:48 -05:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-12-28 13:23:13 -05:00
|
|
|
snippet actt "Symfony2 action and template" b
|
2013-08-03 08:50:12 -04:00
|
|
|
/**
|
2017-08-03 11:21:37 -04:00
|
|
|
* @Route("$3", name="$4")
|
2013-08-03 08:50:12 -04:00
|
|
|
* @Method({${5:"GET"}})
|
|
|
|
* @Template()
|
|
|
|
*/
|
2017-08-03 11:21:37 -04:00
|
|
|
public function $1Action($2)
|
2013-08-03 08:50:12 -04:00
|
|
|
{
|
2017-08-03 11:21:37 -04:00
|
|
|
$6
|
2013-08-03 08:50:12 -04:00
|
|
|
return [];
|
2013-11-16 14:45:48 -05:00
|
|
|
}`!p
|
2016-05-14 07:57:54 -04:00
|
|
|
relpath = os.path.relpath(path)`
|
2013-08-03 08:50:12 -04:00
|
|
|
endsnippet
|
|
|
|
|
2013-12-28 13:23:13 -05:00
|
|
|
snippet comm "Symfony2 command" b
|
2016-05-14 07:57:54 -04:00
|
|
|
<?php
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
namespace `!p
|
2016-05-14 07:57:54 -04:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2013-08-03 08:50:12 -04:00
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
|
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
|
|
/**
|
2016-05-14 07:57:54 -04:00
|
|
|
* ${3:@author `!v g:snips_author`}
|
2013-08-03 08:50:12 -04:00
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` extends ContainerAwareCommand
|
|
|
|
{
|
|
|
|
protected function configure()
|
|
|
|
{
|
2017-08-03 11:21:37 -04:00
|
|
|
$this->setName('$1')
|
|
|
|
->setDescription('$2')
|
2013-08-03 08:50:12 -04:00
|
|
|
->setDefinition([
|
|
|
|
new InputArgument('', InputArgument::REQUIRED, ''),
|
|
|
|
new InputOption('', null, InputOption::VALUE_NONE, ''),
|
2013-12-28 13:23:13 -05:00
|
|
|
]);
|
2013-08-03 08:50:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
2013-11-16 14:45:48 -05:00
|
|
|
|
2013-12-28 13:23:13 -05:00
|
|
|
snippet subs "Symfony2 subscriber" b
|
2016-05-14 07:57:54 -04:00
|
|
|
<?php
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
namespace `!p
|
2016-05-14 07:57:54 -04:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2013-11-16 14:45:48 -05:00
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
|
|
|
|
|
|
/**
|
2016-05-14 07:57:54 -04:00
|
|
|
* ${1:@author `!v g:snips_author`}
|
2013-11-16 14:45:48 -05:00
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` implements EventSubscriberInterface
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
public static function getSubscribedEvents()
|
|
|
|
{
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-12-28 13:23:13 -05:00
|
|
|
snippet transf "Symfony2 form data transformer" b
|
2016-05-14 07:57:54 -04:00
|
|
|
<?php
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
namespace `!p
|
2016-05-14 07:57:54 -04:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2013-11-16 14:45:48 -05:00
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
use Symfony\Component\Form\DataTransformerInterface;
|
|
|
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
|
|
|
|
|
|
|
/**
|
2016-05-14 07:57:54 -04:00
|
|
|
* ${3:@author `!v g:snips_author`}
|
2013-11-16 14:45:48 -05:00
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` implements DataTransformerInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
2017-08-03 11:21:37 -04:00
|
|
|
public function transform($1)
|
2013-11-16 14:45:48 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
2017-08-03 11:21:37 -04:00
|
|
|
public function reverseTransform($2)
|
2013-11-16 14:45:48 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-12-28 13:23:13 -05:00
|
|
|
snippet ent "Symfony2 doctrine entity" b
|
2016-05-14 07:57:54 -04:00
|
|
|
<?php
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
namespace `!p
|
2016-05-14 07:57:54 -04:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2013-11-16 14:45:48 -05:00
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
/**
|
2016-05-14 07:57:54 -04:00
|
|
|
* ${3:@author `!v g:snips_author`}
|
2013-11-16 14:45:48 -05:00
|
|
|
*
|
|
|
|
* @ORM\Entity()
|
2014-03-11 16:10:50 -04:00
|
|
|
* @ORM\Table(name="`!p
|
2013-11-16 14:45:48 -05:00
|
|
|
tmp = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
tmp = re.sub(r'\B([A-Z])', r'_\1', tmp)
|
|
|
|
snip.rv = tmp.lower()
|
|
|
|
`")
|
|
|
|
*/
|
|
|
|
`!p
|
|
|
|
m = re.search(r'Abstract', path)
|
|
|
|
if m:
|
|
|
|
snip.rv = 'abstract '
|
|
|
|
`class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
`
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="integer")
|
|
|
|
* @ORM\GeneratedValue
|
|
|
|
* @ORM\Id
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-12-28 13:23:13 -05:00
|
|
|
snippet form "Symfony2 form type" b
|
2016-05-14 07:57:54 -04:00
|
|
|
<?php
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
namespace `!p
|
2016-05-14 07:57:54 -04:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2013-11-16 14:45:48 -05:00
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
|
|
|
|
|
|
|
/**
|
2016-05-14 07:57:54 -04:00
|
|
|
* ${2:@author `!v g:snips_author`}
|
2013-11-16 14:45:48 -05:00
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` extends AbstractType
|
|
|
|
{
|
2014-03-11 16:10:50 -04:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
2013-11-16 14:45:48 -05:00
|
|
|
*/
|
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
2014-03-11 16:10:50 -04:00
|
|
|
{
|
2013-11-16 14:45:48 -05:00
|
|
|
}
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
2013-11-16 14:45:48 -05:00
|
|
|
*/
|
|
|
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
2014-03-11 16:10:50 -04:00
|
|
|
{
|
|
|
|
$resolver->setDefaults();
|
|
|
|
}
|
2013-11-16 14:45:48 -05:00
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
2013-11-16 14:45:48 -05:00
|
|
|
*/
|
|
|
|
public function getName()
|
2014-03-11 16:10:50 -04:00
|
|
|
{
|
2017-08-03 11:21:37 -04:00
|
|
|
return '$1';
|
2013-11-16 14:45:48 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
2013-12-28 13:23:13 -05:00
|
|
|
|
|
|
|
snippet ev "Symfony2 event" b
|
2016-05-14 07:57:54 -04:00
|
|
|
<?php
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
namespace `!p
|
2016-05-14 07:57:54 -04:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2013-12-28 13:23:13 -05:00
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
use Symfony\Component\EventDispatcher\Event;
|
|
|
|
|
|
|
|
/**
|
2016-05-14 07:57:54 -04:00
|
|
|
* ${2:@author `!v g:snips_author`}
|
2013-12-28 13:23:13 -05:00
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` extends Event
|
|
|
|
{
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2015-07-13 06:22:46 -04:00
|
|
|
snippet redir "Symfony2 redirect" b
|
2017-08-03 11:21:37 -04:00
|
|
|
$this->redirect($this->generateUrl('$1', $2));
|
2013-12-28 13:23:13 -05:00
|
|
|
endsnippet
|
2015-07-13 06:22:46 -04:00
|
|
|
|
|
|
|
snippet usecontroller "Symfony2 use Symfony\..\Controller" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet usereauest "Symfony2 use Symfony\..\Request" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Symfony\Component\HttpFoundation\Request;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet useroute "Symfony2 use Sensio\..\Route" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet useresponse "Symfony2 use Symfony\..\Response" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Symfony\Component\HttpFoundation\Response;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet usefile "Symfony2 use Symfony\..\File" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Symfony\Component\HttpFoundation\File\UploadedFile;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet useassert "Symfony2 use Symfony\..\Constraints as Assert" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Symfony\Component\Validator\Constraints as Assert;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet usetemplate "Symfony2 use Sensio\..\Template" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet usecache "Symfony2 use Sensio\..\Cache" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet usemethod "Symfony2 use Sensio\..\Method" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet usearray "Symfony2 use Doctrine\..\ArrayCollection" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Doctrine\Common\Collections\ArrayCollection;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet useorm "Symfony2 use Doctrine\..\Mapping as ORM" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use Doctrine\ORM\Mapping as ORM;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet usesecure "Symfony2 use JMS\..\Secure" b
|
2017-08-03 11:21:37 -04:00
|
|
|
use JMS\SecurityExtraBundle\Annotation\Secure;$1
|
2015-07-13 06:22:46 -04:00
|
|
|
endsnippet
|
|
|
|
|