prism/poll-bundle

为 symfony2 设计的简单投票插件

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

This package is not auto-updated.

Last update: 2024-09-24 02:46:58 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 项目的文档 来了解大致内容。