Note you will need a User Bundle so that you can map the UserInterface to your own User entity. You can use whatever User Bundle you prefer. FOSUserBundle is highly rated.
Installation takes only 4 steps:
- Download and install dependencies via Composer.
- Register bundles with AppKernel.php.
- Update your app/config/routing.yml.
- Update your database schema.
Append the following to end of your applications composer.json file (found in the root of your Symfony2 installation):
// composer.json
{
// ...
"require": {
// ...
"codeconsortium/ccdn-forum-bundle": "dev-master"
}
}
NOTE: Please replace dev-master
in the snippet above with the latest stable branch, for example 2.0.*
.
Then, you can install the new dependencies by running Composer's update
command from the directory where your composer.json
file is located:
$ php composer.phar update
Now, Composer will automatically download all required files, and install them
for you. All that is left to do is to update your AppKernel.php
file, and
register the new bundle:
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
new CCDNForum\ForumBundle\CCDNForumForumBundle(),
// ...
);
}
Notice this include KNP Paginator, which is an important dependency.
In your app/config/routing.yml add:
# app/config/routing.yml
CCDNForumForumBundle:
resource: "@CCDNForumForumBundle/Resources/config/routing.yml"
Make sure to add the ForumBundle to doctrines mapping configuration:
# app/config/config.yml
# Doctrine Configuration
doctrine:
orm:
default_entity_manager: default
auto_generate_proxy_classes: "%kernel.debug%"
resolve_target_entities:
Symfony\Component\Security\Core\User\UserInterface: Acme\YourUserBundle\Entity\User
entity_managers:
default:
mappings:
CCDNForumForumBundle:
mapping: true
type: yml
dir: "Resources/config/doctrine"
alias: ~
prefix: CCDNForum\ForumBundle\Entity
is_bundle: true
Replace Acme\YourUserBundle\Entity\User with the user class of your chosen user bundle.
From your projects root Symfony directory on the command line run:
$ php app/console doctrine:schema:update --dump-sql
Take the SQL that is output and update your database manually.
Warning:
Please take care when updating your database, check the output SQL before applying it.
Upgrading to 2.0 from previous install.
If you wish to use default texts provided in this bundle, you have to make sure you have translator enabled in your config.
# app/config/config.yml
framework:
translator: ~
In order to use the forum bundle you will first need to have setup a default forum.
To do this, navigate to en/forum/admin/manage-forums/ and click on 'Create Forum', then add a new forum calls 'default', then you are ready to go! Enjoy!
Change the layout template you wish to use for each page by changing the configs under the labelled section 'layout_templates'.
If you want to have the forum appear as your home page, add this route to your app/config/routing.yml:
# app/config/routing.yml
ccdn_homepage:
pattern: /
defaults: { _controller: CCDNForumForumBundle:UserCategory:index, _locale: en, forumName: default }
Installation should now be complete!
If you need further help/support, have suggestions or want to contribute please join the community at Code Consortium