2013-08-18 23:58:09 -04:00
|
|
|
# sugguestion? report bugs?
|
|
|
|
# go to https://github.com/chrisyue/vim-snippets/issues
|
2013-08-02 10:16:05 -04:00
|
|
|
snippet contr "symfony2 controller" b
|
|
|
|
namespace `!p
|
|
|
|
abspath = os.path.abspath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
|
|
|
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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ${1:@author `whoami`}${2}
|
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` extends Controller
|
|
|
|
{
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet act "symfony2 action" b
|
2013-08-18 23:58:09 -04:00
|
|
|
/**
|
|
|
|
* @Route("${3}", name="${4}")
|
|
|
|
* @Method({${5:"POST"}})
|
|
|
|
*/
|
|
|
|
public function ${1}Action(${2})
|
|
|
|
{
|
|
|
|
${6}
|
|
|
|
return $this->redirect($this->generate('home', [], false));
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet actt "symfony2 action and template" b
|
2013-08-02 10:16:05 -04:00
|
|
|
/**
|
|
|
|
* @Route("${3}", name="${4}")
|
|
|
|
* @Method({${5:"GET"}})
|
|
|
|
* @Template()
|
|
|
|
*/
|
|
|
|
public function ${1}Action(${2})
|
|
|
|
{
|
|
|
|
${6}
|
|
|
|
return [];
|
2013-08-18 23:58:09 -04:00
|
|
|
}`!p
|
|
|
|
abspath = os.path.abspath(path)`
|
2013-08-02 10:16:05 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet comm "symfony2 command" b
|
|
|
|
namespace `!p
|
|
|
|
abspath = os.path.abspath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
|
|
|
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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ${3:@author `whoami`}${4}
|
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` extends ContainerAwareCommand
|
|
|
|
{
|
|
|
|
protected function configure()
|
|
|
|
{
|
|
|
|
$this
|
|
|
|
->setName('${1}')
|
|
|
|
->setDescription('${2}')
|
|
|
|
->setDefinition([
|
|
|
|
new InputArgument('', InputArgument::REQUIRED, ''),
|
|
|
|
new InputOption('', null, InputOption::VALUE_NONE, ''),
|
|
|
|
])
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
2013-08-23 01:59:47 -04:00
|
|
|
|
|
|
|
snippet subs "symfony2 subscriber" 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\EventDispatcher\EventSubscriberInterface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ${1:@author `whoami`}${2}
|
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` implements EventSubscriberInterface
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
public static function getSubscribedEvents()
|
|
|
|
{
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet transf "symfony2 form data transformer" 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\DataTransformerInterface;
|
|
|
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ${3:@author `whoami`}${4}
|
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` implements DataTransformerInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
public function transform(${1})
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
public function reverseTransform(${2})
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
2013-08-31 00:55:47 -04:00
|
|
|
|
|
|
|
snippet ent "symfony2 doctrine entity" b
|
|
|
|
namespace `!p
|
|
|
|
abspath = os.path.abspath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ${3:@author `whoami`}${4}
|
|
|
|
*
|
|
|
|
* @ORM\Entity()
|
|
|
|
* @ORM\Table(name="`!p snip.rv = re.match(r'.*(?=\.)', fn).group().lower()`")
|
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
`
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="integer")
|
|
|
|
* @ORM\GeneratedValue
|
|
|
|
* @ORM\Id
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
}
|
|
|
|
endsnippet
|