. // }}} namespace Component\Notification\Entity; use App\Core\Entity; /** * Entity for object attentions * * An attention is a form of persistent notification. * It exists together and for as long as the object it belongs to. * Creating an attention requires creating a Notification. * * @category DB * @package GNUsocial * * @author Zach Copley * @copyright 2010 StatusNet Inc. * @author Mikael Nordfeldth * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org * @author Diogo Peralta Cordeiro <@diogo.site> * @copyright 2021-2022 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ class Attention extends Entity { // {{{ Autocode // @codeCoverageIgnoreStart private string $object_type; private int $object_id; private int $target_id; public function setObjectType(string $object_type): self { $this->object_type = mb_substr($object_type, 0, 32); return $this; } public function getObjectType(): string { return $this->object_type; } public function setObjectId(int $object_id): self { $this->object_id = $object_id; return $this; } public function getObjectId(): int { return $this->object_id; } public function setTargetId(int $target_id): self { $this->target_id = $target_id; return $this; } public function getTargetId(): int { return $this->target_id; } // @codeCoverageIgnoreEnd // }}} Autocode public static function schemaDef(): array { return [ 'name' => 'attention', 'description' => 'Attentions to actors (these are not mentions)', 'fields' => [ 'object_type' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'the name of the table this object refers to'], 'object_id' => ['type' => 'int', 'not null' => true, 'description' => 'id in the referenced table'], 'target_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'actor_id for feed receiver'], ], 'primary key' => ['object_type', 'object_id', 'target_id'], 'indexes' => [ 'attention_object_id_idx' => ['object_id'], 'attention_target_id_idx' => ['target_id'], ], ]; } }