happyr/user-project-bundle
Composer 安装命令:
composer require happyr/user-project-bundle
包简介
If you have multiple users that will share access to one or more objects.
README 文档
README
If you have multiple users that will share access to one or more objects.
Installation
Step 1: Using Composer
Install it with Composer!
// composer.json { // ... require: { // ... "happyr/user-project-bundle": "dev-master", } }
Then, you can install the new dependencies by running Composer's update
command from the directory where your composer.json file is located:
$ php composer.phar update
Step 2: Register the bundle
To register the bundles with your kernel:
<?php // in AppKernel::registerBundles() $bundles = array( // ... new Happyr\UserProjectBundle\HappyrUserProjectBundle(), // ... );
Step 3: Init ACL
If you have not done it before, it is time to init the ACL. If you like, you could read about access control lists or you could just run this command:
php app/console init:acl
Step 4: Configure the bundle
# app/config/config.yml #happyr_user_project: #no config at this point
Requirements
Your User object must implement Happyr\UserProjectBundle\Model\ProjectMemberInterface. Your other object that is in the project must implement Happyr\UserProjectBundle\Model\ProjectObjectInterface.
http://symfony.com/doc/current/cookbook/doctrine/resolve_target_entity.html
use Happyr\UserProjectBundle\Model\ProjectObjectInterface; use Happyr\UserProjectBundle\Entity\Project; class MyObject implements ProjectObjectInterface { /** * @var \Happyr\UserProjectBundle\Entity\Project project * * @ORM\ManyToOne(targetEntity="Happyr\UserProjectBundle\Entity\Project", inversedBy="objects", cascade={"persist"}) * */ protected $project; public function getId() { return $this->id } public function getProject() { $this->project; } /** * * @param Project $project * */ public function setProject(Project $project) { $this->project=$project; } }
Routing
# app/config/routing.yml happyr_user_project: resource: "@HappyrUserProjectBundle/Resources/config/routing.yml" prefix: /
统计信息
- 总下载量: 322
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-01-01