Skip to content

Commit 2ab7f91

Browse files
committed
Merge pull request #272 from chrisyue/master
add symfony2 doctrine entity template
2 parents 7cef242 + 5386637 commit 2ab7f91

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

UltiSnips/php/symfony2.snippets

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,32 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
153153
}
154154
}
155155
endsnippet
156+
157+
snippet ent "symfony2 doctrine entity" b
158+
namespace `!p
159+
abspath = os.path.abspath(path)
160+
m = re.search(r'[A-Z].+(?=/)', abspath)
161+
if m:
162+
snip.rv = m.group().replace('/', '\\')
163+
`;
164+
165+
use Doctrine\ORM\Mapping as ORM;
166+
167+
/**
168+
* ${3:@author `whoami`}${4}
169+
*
170+
* @ORM\Entity()
171+
* @ORM\Table(name="`!p snip.rv = re.match(r'.*(?=\.)', fn).group().lower()`")
172+
*/
173+
class `!p
174+
snip.rv = re.match(r'.*(?=\.)', fn).group()
175+
`
176+
{
177+
/**
178+
* @ORM\Column(type="integer")
179+
* @ORM\GeneratedValue
180+
* @ORM\Id
181+
*/
182+
private $id;
183+
}
184+
endsnippet

0 commit comments

Comments
 (0)