idci/partner-bundle

Symfony PartnerBundle

dev-master 2013-07-04 09:52 UTC

This package is auto-updated.

Last update: 2024-11-24 20:42:18 UTC


README

A Partner Bundle for Symfony2

Content

This bundle was developped for a specific project, but is made to suit with more. It allows to add Partners management in a project. You have also an API usable for web-service. With a partner comes locations, offers from partners, a partner category and social links. Feel free to contribute, fork this bundle and add what you need.

Installation

To install this bundle please follow the next steps:

First add the dependencies to your composer.json file:

"require": {
    ...
    "pagerfanta/pagerfanta": "dev-master",
    "white-october/pagerfanta-bundle": "dev-master",
    "idci/partner-bundle": "dev-master"
},

And install the bundle with the command:

php composer.phar update

Enable the bundle in your application kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
        new IDCI\Bundle\PartnerBundle\IDCIPartnerBundle(),
    );
}

In your routing.yml file, add the following:

idci_partner:
    resource: "../../vendor/idci/partner-bundle/IDCI/Bundle/PartnerBundle/Controller"
    type:     annotation
    prefix:   /admin

As you can see, we use WhiteOctoberPagerFantaBundle to paginate list results. So you have to define the max_per_page parameter in your app/config/parameters.yml

parameters:
    ...
    max_per_page:  25

Now, you have to install bootstrap:

If it isn't done yet, configure your database.

Edit your parameters.yml file. Here is an exemple which might help you:

parameters:
    database_driver:   pdo_mysql
    database_host:     localhost
    database_port:     ~
    database_name:     sf_partner
    database_user:     root
    database_password: MyPassword

    mailer_transport:  smtp
    mailer_host:       localhost
    mailer_user:       ~
    mailer_password:   ~

    locale:            en
    secret:            ThisTokenIsNotSoSecretChangeIt

Run theses commands in your workspace directory:

php app/console doctrine:database:create
php app/console doctrine:schema:create

Else, just run the following:

php app/console doctrine:schema:update

Now the Bundle is installed and ready to use. You will find new routes by running this command:

php app/console router debug

...
admin_partner                 ANY    ANY  /admin/partner/
admin_partner_category        ANY    ANY  /admin/partner/category/
admin_partner_category_show   ANY    ANY  /admin/partner/category/{id}/show
admin_partner_category_new    ANY    ANY  /admin/partner/category/new
admin_partner_category_create POST   ANY  /admin/partner/category/create
admin_partner_category_edit   ANY    ANY  /admin/partner/category/{id}/edit
admin_partner_category_update POST   ANY  /admin/partner/category/{id}/update
admin_partner_category_delete POST   ANY  /admin/partner/category/{id}/delete
admin_partner_partner         ANY    ANY  /admin/partner/partner/
admin_partner_partner_show    ANY    ANY  /admin/partner/partner/{id}/show
admin_partner_partner_new     ANY    ANY  /admin/partner/partner/new
admin_partner_partner_create  POST   ANY  /admin/partner/partner/create
admin_partner_partner_edit    ANY    ANY  /admin/partner/partner/{id}/edit
admin_partner_partner_update  POST   ANY  /admin/partner/partner/{id}/update
admin_partner_partner_delete  POST   ANY  /admin/partner/partner/{id}/delete