mwsimple/foro

这个foro捆绑包

安装: 45

依赖: 0

建议者: 0

安全: 0

星星: 0

关注者: 2

分支: 2

开放问题: 0

类型:symfony-bundle

dev-master / 1.0.x-dev 2016-11-29 13:53 UTC

This package is auto-updated.

Last update: 2024-09-10 11:19:54 UTC


README

目标

  • 提供讨论区。
  • 用户编辑器,可以创建组,每个组可以拥有编辑器/组编辑器,组编辑器可以添加成员。
  • 组编辑器和组内成员可以创建讨论。
  • 组编辑器或成员可以回复讨论。

安装

使用composer

将以下行添加到您的composer.json文件中

支持Symfony 2.7.* + 包含Bootstrap 3

"require": {
    ...
    "mwsimple/foro": "1.0.*@dev",
}

执行

php composer.phar update "mwsimple/foro"

将其添加到AppKernel.php类中

// ...
new MWSimple\Bundle\ForoBundle\MWSimpleForoBundle(),

注册捆绑包

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Knp\Bundle\TimeBundle\KnpTimeBundle(),
    );
    // ...
}

配置实体

在您的UserFos实体中实现Interface FosUserSubjectInterface

...
// DON'T forget this use statement!!!
use MWSimple\Bundle\ForoBundle\Model\FosUserSubjectInterface;
...
class User extends BaseUser implements FosUserSubjectInterface  {
    ...
    
    /**
     * @return string
     */
    public function getName()
    {
        return $this->username;
    }

    ...
}

配置您的config.yml

imports:
    # ForoBundle services
    - { resource: "@MWSimpleForoBundle/Resources/config/services.yml" }

    ...

parameters:
    # entity referenced to FosUserSubjectInterface
    # entity referenced to FosUserSubjectInterface in this example:
    subjectInterface: Sistema\UserBundle\Entity\User

    ...

# Doctrine Configuration
doctrine:
    orm:
        auto_mapping: true
        # resolve_target attach to the subject entity for other thirds entities 
        resolve_target_entities:
            # configuration of the parameters attach fos
            MWSimple\Bundle\ForoBundle\Model\FosUserSubjectInterface: "%subjectInterface%"

    ...

在routing.yml中配置您自己的路由,以forobundle动态适应您的目的

示例

# all routes from forobundle
mw_simple_front:
    resource: "@MWSimpleForoBundle/Controller/"
    type:     annotation
    prefix:   /foro

# one route especific in this case DefaultController Index
front_foro:
    path: /mws_front_foro/
    defaults:
        _controller: MWSimpleForoBundle:Default:index
        template:    index.html.twig

# other route especific only for the foro groups create with security own, show GrupoController Index
# one route especific only for the foro groups create with security, show GrupoController Index
admin_foro_grupo:
    path: /admin/foro/grupo
    defaults:
        _controller: MWSimpleForoBundle:Grupo:index
        template:    index.html.twig

# route for redirect view after create new entry
# foro_mws:
#     pattern: /matriculado/foro/{foro_id}
#     defaults:
#         _controller: SistemaCPCEBundle:Default:foro
#         template:    index.html.twig
#     requirements:
#         _method:  GET
#         foro_id: \d+

    ...

导入您的控制器RENDERS,例如front_foro视图

或配置您自己的foro注释路由。

在任何控制器中

...
class defaultController  {
    ...
    
    /**
     * @Route("/foro/{foro_id}", name="foro_mws")
     * @Template()
     */
    public function foroAction($foro_id = 0)
    {
         
        //Create a view of foro.html.twig for render Front of ForoBundle
        return array('foro_id' => $foro_id);
    }

    ...
}

导入您的控制器RENDERS,例如TWIG中的front_foro视图

在这种情况下是ForoBundle的前端视图

    {# corresponds to the configurations in yours routing.yml #}
    {{ render(url('front_foro')) }}

作者

TECSPRO - contacto@tecspro.com.ar