PHP snippet

This commit is contained in:
Simon Vieille 2017-02-07 00:06:47 +01:00
parent f9baea9873
commit f3c4382b05

View file

@ -85,7 +85,12 @@ endsnippet
snippet page "Create trinity page"
<?php
`!p snip.rv = os.popen('/home/simon/bin/namespace ' + path).readline().strip()`
namespace `!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use Trinity\Bundle\ContentManagerBundle\Model\Page;
use Trinity\Bundle\ContentManagerBundle\Model\Block;
@ -169,7 +174,12 @@ endsnippet
snippet command "Create sf2 command"
<?php
`!p snip.rv = os.popen('/home/simon/bin/namespace ' + path).readline().strip()`
namespace `!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
@ -214,7 +224,12 @@ endsnippet
snippet controller "Create trinity controller"
<?php
`!p snip.rv = os.popen('/home/simon/bin/namespace ' + path).readline().strip()`
namespace `!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\ContentManagerBundle\Controller\PageController;
@ -248,7 +263,12 @@ endsnippet
snippet form "Create sf2 form"
<?php
`!p snip.rv = os.popen('/home/simon/bin/namespace ' + path).readline().strip()`
namespace `!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use Propel\PropelBundle\Form\BaseAbstractType;
use Symfony\Component\Form\FormBuilderInterface;
@ -329,7 +349,12 @@ endsnippet
snippet class "Class" b
<?php
`!p snip.rv = os.popen('/home/simon/bin/namespace ' + path).readline().strip()`
namespace `!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
/**
* class $1.