Development

Changeset 4047

You must first sign up to be able to contribute.

Changeset 4047

Show
Ignore:
Timestamp:
05/19/07 02:05:18 (6 years ago)
Author:
Jonathan.Wage
Message:

sfDoctrineFriendsPlugin?: Added usage examples.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfDoctrineFriendsPlugin/README

    r3924 r4047  
     1= Symfony Doctrine Friends Plugin = 
     2 
     3Modeling and helpers for a simple friends system between users 
     4 
     5== Configuation == 
     6 
     7In your project config directory create a file named sfDoctrineFriendsPlugin.yml and place this in it. In this example my friend table is named 'friend' and the user model being used if 'sfGuardUser' and the user model id is 'id' 
     8 
     9This just allows you to link your user system to the friends plugin, and customize the table name for the plugin. 
     10{{{ 
     11schema: 
     12  friend_table:  friend 
     13  user_model:    sfGuardUser 
     14  user_model_id: id 
     15}}} 
     16 
     17== Usage == 
     18 
     19{{{ 
     20<?php 
     21$friend = FriendTable::retrieveFriend($id); // retrieve friend record by id 
     22FriendTable::deleteFriend($id); // delete friend record by id 
     23 
     24// Create new friend between $myUserId and $friendUserId 
     25$friend = FriendTable::newUserFriend($myUserId, $friendUserId); 
     26$friend->save(); 
     27 
     28$friends = FriendTable::retrieveUserFriends($myUserId); 
     29print_r($friends); 
     30 
     31$friend = FriendTable::retrieveUserFriend($myUserId, $friendUserId); 
     32 
     33$exists = FriendTable::userFriendExists($myUserId, $friendUserId); 
     34echo $exists ? true:false; 
     35?> 
     36}}}