sfDoctrineActAsRattablePlugin
0.0.1stable
for sf 1.2 and Doctrine
MIT
This plugin permits to attach rates to Doctrine objects
You can discuss about this plugin on the google group sfDoctrineActAsRattable
Full (and up to date) documentation available on the my wiki
To add tickets, go on : my project management
DOCTRINE 1.1 REQUIRED
You can use branche 1.2 for doctrine 1.0, thank Rabii
Developers
License
Copyright (c) 2007 Mickael Kurmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Releases for sf 1.2
| Version |
License |
API |
Released |
|
0.0.1stable
|
MIT |
0.0.1stable
|
23/05/2009 |
Changelog for release 0.0.1 - 23/05/2009
Other releases
Release 0.0.1 - 23/05/2009
sfDoctrineActAsRattablePlugin
Introduction
This plugin permits to attach rates to Doctrine objects
You can discuss about this plugin on the google group sfDoctrineActAsRattable
Full (and up to date) documentation available on the symfony wiki
Features
- add/remove ratings
- manage multiple ratings
- get average rating
- get commented ratings
- be notified when an object is rated
How it works
Giving Rattable behavior to an object the same as Doctrine I18n
It create an object_rate table with how many column as criterias OR default one : rate
Example :
hotel_room:
actAs:
Rattable:
criterias: [clean_state, receptionist, equipment]
max_rate: 5
rounding_rate: 1
Will create 2 tables:
1 hotel_room
1 hotel_room_rate, with columns:
clean_state
reception
equipment
comment
user_id # foreignKey to sfGuardUser if exists
Installation
Symfony way
SVN way
Configuration
configure your object :
my_object:
actAs:
Rattable:
criterias: rate # or [clean_state, receptionist, equipment] only if you wanna rate specifics parts
max_rate: 5 # 2,10 etc. any integer number you want (more than 20 is a bad idea, work with rounding instead)
rounding_rate: 1 # or 0.1, 0.2 etc.
with_comment: true # false
rebuild the model:
./symfony doctrine-build-all
clear cache:
./symfony cc
API
The plugin implements the following methods to the object:
- getRates()
- getRating()
- addRate(RategObject $rateObject)
- removeRatings()
- getRatesQuery()
Events notifications types
- rate.add notify
- rate.remove notify
Helpers
Examples
Todo
- notification management
- give examples
- create helpers
- create components to show ratings
- add icons possibility for ratings types
Unit testing
The plugin has been unit-tested, perhaps not fully (I'm a newbie in unit tests). The tests are located in developpment branch.
Side notes
I won't release pear packages, if someone is interested in managing them, let met know and I will add you as package manager.
License and credits
This plugin has been created by Mickael Kurmann and is licensed under the MIT license.
I took my inspiration from :