Static Public Member Functions |
static | model ($className=__CLASS__) |
Public Attributes |
const | STATUS_CANCELED = -1 |
const | STATUS_NOT_APPROVED = 0 |
const | STATUS_APPROVED = 1 |
Detailed Description
Definition at line 18 of file Friendship.php.
Member Function Documentation
Friendship::afterFind |
( |
| ) |
|
|
protected |
If the user was removed after friendship with him was created gportal will destruct such relations to avoid errors
Definition at line 121 of file Friendship.php.
{
if(!isset($this->user1) || !isset($this->user2)){
$this->delete();
}
}
Friendship::friend |
( |
|
$user_id | ) |
|
Returns friend User model.
- Parameters
-
int | $user_id | id of some user in this friendship |
- Returns
- null|User his friend
Definition at line 73 of file Friendship.php.
{
if ($user_id == $this->user1_id) {
return $this->user2;
} elseif ($user_id == $this->user2_id) {
return $this->user1;
}
return null;
}
Friendship::me |
( |
|
$user_id | ) |
|
Get User model of user with $user_id
- Parameters
-
int | $user_id | id of some user in this friendship |
- Returns
- null|User his model
Definition at line 90 of file Friendship.php.
{
if ($user_id == $this->user1->id) {
return $this->user1;
} elseif ($user_id == $this->user2->id) {
return $this->user2;
}
return null;
}
static Friendship::model |
( |
|
$className = __CLASS__ | ) |
|
|
static |
Friendship::myRequest |
( |
|
$user_id | ) |
|
Check if user with $user_id make friend request or not
- Parameters
-
int | $user_id | id of needed user |
- Returns
- bool
Definition at line 107 of file Friendship.php.
{
if ($user_id == $this->user1->id) {
return true;
}
return false;
}
Friendship::tableName |
( |
| ) |
|
Returns the name of the associated database table. By default this method returns the class name as the table name. You may override this method if the table is not named after this convention.
- Returns
- string the table name
Definition at line 44 of file Friendship.php.
{
return '{{friendship}}';
}
The documentation for this class was generated from the following file: