summaryrefslogtreecommitdiffstats
path: root/models/Friends.php
diff options
context:
space:
mode:
authorMichael Francis <edude03@gmail.com>2011-07-16 00:50:36 -0400
committerMichael Francis <edude03@gmail.com>2011-07-16 00:51:12 -0400
commit8e468b8605eb1a85d32dbba4d41a9821daaa4016 (patch)
tree1b596a89ce0c8362883ebd3727a216155a0cf74a /models/Friends.php
parenta277c978e66c970231b3cf987d220f3476fe456e (diff)
downloadotakuhub-8e468b8605eb1a85d32dbba4d41a9821daaa4016.tar.xz
Implemented mySQL based friending
Diffstat (limited to 'models/Friends.php')
-rw-r--r--models/Friends.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/models/Friends.php b/models/Friends.php
new file mode 100644
index 0000000..67d747a
--- /dev/null
+++ b/models/Friends.php
@@ -0,0 +1,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";
+ }
+ }
+ }
+}
+?> \ No newline at end of file