codemonkeys-ru/repository-alias-bundle
Composer 安装命令:
composer require codemonkeys-ru/repository-alias-bundle
包简介
Symfony2 bundle providing alias syntax for working with entity repositories
README 文档
README
Bundle provides alternative syntax for working with entity repositories. See Example section for more.
Installation
Install thru composer
php composer.phar require codemonkeys-ru/repository-alias-bundle
And add bundle to your AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
...
new CodeMonkeysRu\RepositoryAliasBundle\RepositoryAliasBundle(),
...
}
}
Example
config.yml
repository_alias:
repository_key: "project.repo"
repository:
blogpost: AcmeBundle:Blog\Post
blogcomment: AcmeBundle:Blog\Comment
Instead of:
$repo = $this->getDoctrine()->getRepository('AcmeBundle:Blog\Post');
$post = new Acme\AcmeBundle\Blog\Post('title', 'post', $author);
Use:
$repo = $this->get('project.repo.blogpost'); //Note repository_key "project.repo" usage.
$post = $this->get('project.repo.blogpost')->newEntity('title', 'post', $author);
ChangeLog
v0.1.3
- Added getOriginalRepository decorator. Useful while configuring repos thru di container
v0.1.2
- Added getAliasFor() method
v0.1.1
- Added backloop interface
v0.1.0
- Initial version
统计信息
- 总下载量: 52
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-10-21