smirik / propel-likeable-behavior
Add functionality to like objects.
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 5 552
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 1
Requires
- propel/propel1: 1.6.*
This package is not auto-updated.
Last update: 2021-07-09 22:29:59 UTC
README
Installation
Download LikeableBehavior.php and put it somewhere.
propel.behavior.likeable.class = path.to.likeable.behavior
If you are using composer then just add:
{ "require": { "smirik/propel-likeable-behavior": "*" } }
Usage
Add to schema.xml:
<behavior name="likeable" />
Behavior will create table likes and add several methods to the Model:
public function addLike($user_id, $mark = 1, PropelPDO $con = null); public function removeLike($user_id, PropelPDO $con = null) public function hasLike($user_id, PropelPDO $con = null) public function countLikes(PropelPDO $con = null)
user_id could be any integer.
Requirements
- Model should have getId() method.
- Type will be placed automatically based on class name (with namespace)
Credits
- William Durand william.durand1@gmail.com for documentation.
- Glorpen https://bitbucket.org/glorpen/taggablebehaviorbundle for samples.