add symfony2 form snip
This commit is contained in:
parent
f499a1a0d7
commit
2a0cd591e7
@ -64,7 +64,7 @@ endsnippet
|
|||||||
snippet sg "Setter and Getter" b
|
snippet sg "Setter and Getter" b
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ${3:`!p snip.rv = t[2].capitalize()`}${4}
|
* @var ${3:`!p snip.rv = t[2].capitalize()`}
|
||||||
*/
|
*/
|
||||||
${1:protected} $$2;
|
${1:protected} $$2;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# sugguestion? report bugs?
|
# sugguestion? report bugs?
|
||||||
# go to https://github.com/chrisyue/vim-snippets/issues
|
# go to https://github.com/chrisyue/vim-snippets/issues
|
||||||
|
|
||||||
snippet contr "symfony2 controller" b
|
snippet contr "symfony2 controller" b
|
||||||
namespace `!p
|
namespace `!p
|
||||||
abspath = os.path.abspath(path)
|
abspath = os.path.abspath(path)
|
||||||
@ -15,7 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${1:@author `whoami`}${2}
|
* ${1:@author `whoami`}
|
||||||
*/
|
*/
|
||||||
class `!p
|
class `!p
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||||
@ -65,7 +66,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${3:@author `whoami`}${4}
|
* ${3:@author `whoami`}
|
||||||
*/
|
*/
|
||||||
class `!p
|
class `!p
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||||
@ -100,7 +101,7 @@ if m:
|
|||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${1:@author `whoami`}${2}
|
* ${1:@author `whoami`}
|
||||||
*/
|
*/
|
||||||
class `!p
|
class `!p
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||||
@ -132,7 +133,7 @@ use Symfony\Component\Form\DataTransformerInterface;
|
|||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${3:@author `whoami`}${4}
|
* ${3:@author `whoami`}
|
||||||
*/
|
*/
|
||||||
class `!p
|
class `!p
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||||
@ -165,7 +166,7 @@ if m:
|
|||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${3:@author `whoami`}${4}
|
* ${3:@author `whoami`}
|
||||||
*
|
*
|
||||||
* @ORM\Entity()
|
* @ORM\Entity()
|
||||||
* @ORM\Table(name="`!p snip.rv = re.match(r'.*(?=\.)', fn).group().lower()`")
|
* @ORM\Table(name="`!p snip.rv = re.match(r'.*(?=\.)', fn).group().lower()`")
|
||||||
@ -182,3 +183,47 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|||||||
private $id;
|
private $id;
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet form "symfony2 form type" b
|
||||||
|
namespace `!p
|
||||||
|
abspath = os.path.abspath(path)
|
||||||
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
|
if m:
|
||||||
|
snip.rv = m.group().replace('/', '\\')
|
||||||
|
`;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${2:@author `whoami`}
|
||||||
|
*/
|
||||||
|
class `!p
|
||||||
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||||
|
` extends AbstractType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return '${1}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
Loading…
x
Reference in New Issue
Block a user