From 72b07245f44c73ed41bfcca2465a9ee34426a922 Mon Sep 17 00:00:00 2001 From: winter Date: Thu, 19 Dec 2024 20:59:18 +0000 Subject: implement follow relationships (untested) does NOT implement the actual behaviour behind follows (receiving posts and such) --- Digitigrade/Model/FollowRelation.php | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Digitigrade/Model/FollowRelation.php (limited to 'Digitigrade/Model/FollowRelation.php') diff --git a/Digitigrade/Model/FollowRelation.php b/Digitigrade/Model/FollowRelation.php new file mode 100644 index 0000000..fc43a6f --- /dev/null +++ b/Digitigrade/Model/FollowRelation.php @@ -0,0 +1,37 @@ +subject = $subject; + $rel->object = $object; + $rel->status = $status; + $rel->save(); + return $rel; + } + + protected function getUpdateWhereClause(\PDO $db): ?string { + if (self::findWhere('subject = ? and object = ?', [$this->subject->id, $this->object->id]) != null) { + return 'subject = ' . $this->subject->id . ' and object = ' . $this->object->id; + } + return null; + } + + public static function findByActors(Actor $subject, Actor $object): ?self { + return self::findWhere('subject = ? and object = ?', [$subject->id, $object->id]); + } +} \ No newline at end of file -- cgit v1.3