2017 © Pedro PelĂĄez
 

symfony-bundle foro

This bundle foro

image

mwsimple/foro

This bundle foro

  • Tuesday, November 29, 2016
  • by gonzakpo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ForoBundle

Objetivos

  • Proveer de un foro de debates.
  • Usuario editor, podrĂĄ crear grupos y cada grupo tener editor/es de grupo, los editores de grupo pueden incluir miembros.
  • Pueden crear debates los editores del grupo y los miembros incluidos en el grupo.
  • Los editores o miembros del grupo pueden responder al debate.

Installation

Using composer

Add following lines to your composer.json file:, (*1)

Support Symfony 2.7.* + Include Boostrap 3

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

Execute:, (*2)

php composer.phar update "mwsimple/foro"

Add it to the AppKernel.php class:, (*3)

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

Register the bundle:, (*4)

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

Configure Entities

Implements Interface FosUserSubjectInterface in YOU UserFos Entity

...
// 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;
    }

    ...
}

Configure your 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%" ...

Configure your own routings with the forobundle dynamically for yours own purposes in routing.yml

EXAMPLES


# 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+ ...

Importing yours controllers RENDERS, example front_foro view

OR Configure your own annotations route for the foro.

In any Controller

...
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);
    }

    ...
}

Importing yours controllers RENDERS, example front_foro view in TWIG

in this case is the Front view of ForoBundle

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

Author

TECSPRO - contacto@tecspro.com.ar, (*5)

The Versions