matteosister avatar matteosister committed aff9d92

tweaked readme

Comments (0)

Files changed (1)

------------------------
-sfPropel15RatablePlugin
------------------------
+--------------------------------
+sfPropelORMRatableBehaviorPlugin
+--------------------------------
 
-A behaviour for propel 1.5/1.6 and symfony 1.4.x to rate your objects
+A behaviour for propel 1.6.x and symfony 1.4.x to rate your objects
 
 How to install
 --------------
 
 - add this plugin as a submodule
 
-    git submodule add git://github.com/matteosister/sfPropel15RatableBehaviorPlugin.git plugins/sfPropel15RatableBehaviorPlugin
+    git submodule add https://matteosister@bitbucket.org/matteosister/sfpropelormratablebehaviorplugin.git plugins/sfPropelORMRatableBehaviorPlugin
 
 - enable the plugin in your **ProjectConfiguration** class
 
       public function setup()
       {
         // ...
-        $this->enablePlugins('sfPropel15RatableBehaviorPlugin');
-        // ...
+        $this->enablePlugins('sfPropelORMRatableBehaviorPlugin');
       }
     }
 
     <behavior name="ratable">
         <!-- the db name of the average column -->
         <parameter name="average_column" value="the_average"></parameter>
-        <!-- the php name of the average column -->
-        <parameter name="average_column_phpname" value="Average"></parameter>
         <!-- the db name of the votes number column -->
         <parameter name="nb_votes_column" value="ratable_nb_votes"></parameter>
-        <!-- the php name of the votes number column -->
-        <parameter name="nb_votes_column_phpname" value="NbVotes"></parameter>
-        <!-- the average precision  -->
-        <parameter name="precision" value="1"></parameter>
+        <!-- maximum vote, from 1 to ... -->
+        <parameter name="max_vote" value="10" />
     </behavior>
 
-The precision value is passed to the php round function to store and retrieve average from db
-
-[php function round] http://it.php.net/manual/en/function.round.php
 
 In the base class of your object model you'll find two new methods:
 
 ::
 
-    public function getRating($max = 5, $precision = 1) // $max and $precision default values comes from the schema parameters
+    public function getRating($max = ...) // $max default value comes from the schema parameters
     public function setRating($rating)
 
 see the class comments for reference
     <?php
     $article = new Article(); // nb_votes: 0, avg: null
 
-    $article->setRating(3); // you need to call the save() method to actually write the data to db.
-    $article->save() // nb_votes: 1, avg: 3
+    $article->setRating(6); // you need to call the save() method to actually write the data to db.
+    $article->save() // nb_votes: 1, avg: 6
 
-    $article->setRating(4);
-    $article->save(); // nb_votes: 2, avg: 3.5
+    $article->setRating(10);
+    $article->save(); // nb_votes: 2, avg: 8
 
-    $article->getRating(); // 3.5 out of 5
-    $article->getRating(10); // 7 out of 10
-    $article->getRating(5, 0); // 4 out of 5
+    $article->getRating(); // 6 out of 10
+    $article->getRating(20); // 16 out of 20
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.