tito/poll-bundle

为 symfony2 的一款简单投票包

安装: 12

依赖项: 0

建议者: 0

安全: 0

星级: 0

关注者: 2

分支: 13

类型:symfony-bundle

v2.0 2014-04-18 22:59 UTC

This package is auto-updated.

Last update: 2024-09-07 10:24:32 UTC


README

为 symfony2 的一款简单投票包。

此版本适用于 Symfony 2.4.x 项目。

对于 Symfony 2.0.x 项目,您必须使用此包的 1.x 版本。

特性

  • 已发布投票列表
  • 使用 Ajax 进行投票和显示结果
  • 使用柱状图显示结果
  • 使用 Cookie 防止重复投票
  • 后端界面
  • 易于覆盖

截图

注意:后端不附带认证系统。

待办事项

  • 功能测试
  • 重写 symfony 2.4.x 的“覆盖包”文档

安装

1. 将以下内容添加到您的 composer.json 中

"require": {
    "prism/poll-bundle": "dev-master"
}

2. 运行 composer update

$ composer update

3.app/AppKernel.php 中注册包

(您还需要添加 StofDoctrineExtensionsBundle 以使用 timestampable 和 sluggable 功能)

$bundles = array(
    // ...
    new Prism\PollBundle\PrismPollBundle(),
    new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
);

4. 导入路由

# app/config/routing.yml
PrismPollBundle_backend:
    prefix: /poll/backend
    resource: "@PrismPollBundle/Resources/config/routing/backend.yml"

PrismPollBundle_frontend:
    prefix: /poll
    resource: "@PrismPollBundle/Resources/config/routing/frontend.yml"

5. 为 DoctrineExtensions 添加配置

# app/config/config.yml
stof_doctrine_extensions:
    orm:
        default:
            timestampable: true
            sluggable: true

6. 生成表

$ app/console doctrine:schema:update --force

这将创建 PrismPoll 和 PrismPollOpinion 表

覆盖包

待办事项:重写 symfony 2.4.x 项目的文档。

您可以通过阅读 symfony 2.0.x 项目的 文档 来了解大致思路。