sfReviewPlugin - 1.2

Review management plugin.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Dependencies Releases Changelog Contribute
Show source

sfReview plugin

The sfReviewPlugin is a symfony plugin that allows users from sfGuardPlugin to leave reviews on different entities of an application. We use it to place reviews of spanish politicians at, you are welcome to test it !


Please, use the sql script shipped with each new version to upgrade database:



  • Install the plugin

    $ symfony plugin:install sfReviewPlugin
  • Rebuild your model

    $ symfony propel:build-model
    $ symfony propel:build-sql
    $ symfony propel:build-forms
    $ symfony propel:build-filters
  • Update your database tables by starting from scratch (it will delete all the existing tables, then re-create them):

    $ symfony propel:insert-sql

    or you can just create the new tables by using the generated SQL statements in data/sql/plugins.sfReviewPlugin.lib.model.schema.sql

  • Enable one or more modules in your settings.yml (optional)

    • For your backend application: sfReviewType,sfReviewStatus,sfReview
    • For your frontend application: sfReviewFront

      [php] all: .settings: enabled_modules: [default,sfGuardAuth,sfGuardUser,sfGuardGroup,sfGuardPermission ,sfReviewType,sfReviewStatus,sfReview]

  • Clear you cache

    $ symfony cc
  • Configure status:

    $ symfony review:create-status
  • Configure types (optional):

    $ symfony review:create-type Celebrity

    where Celebrity is the entity to be reviewed

  • Configure SfGuard permissions. Only users whith 'superadmin' or 'moderator' credentials are authorized to access backend modules.

  • Enable i18n for the frontend application (apps/frontend/config/settings.yml):

    [php] all: .settings: i18n: on # Enable interface translation. Set to off if your application should not be translated.

Setup the module to be reviewed

Imagine that we have a module called 'Celebrity' and that our users are going to put reviews of each Celebrity we have in the database. You should have a template in apps/frontend/modules/celebrity/templates/showSucces.php with information about a celebrity. For now, let's say that we are showing only the name of the celebrity:

  <?php echo $celeb->getName() ?>

First of all, we need to setup the view to use the plugin assets: [php] stylesheets: [main.css, /sfReviewPlugin/css/sf_review.css] javascripts: [/sfReviewPlugin/js/sf_review.js, /sfJqueryReloadedPlugin/js/jquery-1.3.2.min.js, /sfJqueryReloadedPlugin/js/jquery-ui-1.7.2.custom.min.js]

Yes, jquery javascripts are also needed. Ok, now we are going to fill the template with the necesary code to put a review on this subject:

  <?php use_helper('Javascript') ?>
  <?php use_helper('jQuery') ?>
  <script type="text/javascript">
        '<?php echo url_for('@sf_review_init') ?>',
        <?php echo $id; ?>,

  <?php echo $celeb->getName() ?>

  <div id="sfreview_box"></div>

Manager and helper

The plugin is shipped with a manager and a helper class that simplifies showing the reviews. In the controller you can ask for reviews of one type:

  $this->positives = SfReviewManager::getReviewsByEntityAndValue($request, 1, $id, 1);
  $this->positiveCount =  SfReviewManager::getTotalReviewsByEntityAndValue(1, $id, 1);
  $this->negatives = SfReviewManager::getReviewsByEntityAndValue($request, 1, $id, -1);
  $this->negativeCount =  SfReviewManager::getTotalReviewsByEntityAndValue(1, $id, -1);

And in the view you can show the review test:

  <?php use_helper('SfReview') ?>
  <?php echo review_text( $the_review ) ?>


This plugin is mainteined by the people from Voota ( Please contact us for any issue or comment at tech [at] We will be glad to hear from you :)

Thank you!