bitheater / rating-bundle
允许对元素进行评分
dev-master
2015-06-27 11:21 UTC
Requires
- php: >=5.4.0
- symfony/framework-bundle: ~2.3
Requires (Dev)
- doctrine/doctrine-bundle: ~1.3
This package is auto-updated.
Last update: 2024-09-29 03:52:30 UTC
README
此包允许你在网页中包含任何类型的元素评分。
建设中,因此请暂时不要使用此包 :)
安装
- 将依赖添加到你的
composer.json文件中:composer require bitheater/rating-bundle - 在
AppKernel.php文件中初始化包:new Bitheater\RatingBundle\BitheaterRatingBundle() - 配置包(目前我们只支持MySQL,但支持其他数据存储应该很简单!)
bitheater_rating: driver: orm model_class: MyBundle\Entity\Vote
创建投票类,继承基本投票类
use Bitheater\RatingBundle\Model\Vote as RatingVote; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity(repositoryClass="Bitheater\RatingBundle\Repository\Doctrine\ORMRepository") * @ORM\Table(name="vote") */ class Vote extends RatingVote { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; public function getId() { return $this->id; } }
- 完成!现在只需使用该服务即可
$ratingManager = $this->get('bitheater_rating.manager');
享受吧!