blob: 67d747a7e1a36d5cdc2d304e0f9b03e41ce9b2dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
namespace app\models;
class Friends extends \lithium\data\Model {
public $validates = array();
public $belongsTo = array('User' => array('keys' => array('FromUserId' => 'id')));
/**
* Returns the opposite value of whatever is passed in (like an enum)
* @param Mixed $input
* @return String or Int;
*/
public static function status($input) {
if (is_int($input)) {
switch($input) {
case "rejected": return 0;
case "accepted": return 1;
case "open": return 2;
}
}
else {
switch($input) {
case 0: return "rejected";
case 1: return "accepted";
case 2: return "open";
}
}
}
}
?>
|