888c3798b7
Fixed various bugs Some important concepts to bear in mind: * Notification: Associated with activities, won't be reconstructed together with objects, can be thought of as transient * Attention: Associated with objects, will be reconstructed with them, can be thought as persistent * Notifications and Attentions have no direct implications. * Mentions are a specific form of attentions in notes, leads to the creation of Attentions. Finally, Potential PHP issue detected and reported: https://github.com/php/php-src/issues/8199 `static::method()` from a non static context (such as a class method) calls `__call`, rather than the expected `__callStatic`. Can be fixed by using `(static fn() => static::method())()`, but the usage of the magic method is strictly unnecessary in this case.
93 lines
2.4 KiB
PHP
93 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types = 1);
|
|
|
|
namespace Plugin\WebMonetization\Entity;
|
|
|
|
use App\Core\Entity;
|
|
|
|
class WebMonetization extends Entity
|
|
{
|
|
// These tags are meant to be literally included and will be populated with the appropriate fields, setters and getters by `bin/generate_entity_fields`
|
|
// {{{ Autocode
|
|
// @codeCoverageIgnoreStart
|
|
private int $id;
|
|
private int $sender;
|
|
private int $receiver;
|
|
private float $sent;
|
|
private bool $active;
|
|
|
|
public function setId(int $id): self
|
|
{
|
|
$this->id = $id;
|
|
return $this;
|
|
}
|
|
|
|
public function getId(): int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setSender(int $sender): self
|
|
{
|
|
$this->sender = $sender;
|
|
return $this;
|
|
}
|
|
|
|
public function getSender(): int
|
|
{
|
|
return $this->sender;
|
|
}
|
|
|
|
public function setReceiver(int $receiver): self
|
|
{
|
|
$this->receiver = $receiver;
|
|
return $this;
|
|
}
|
|
|
|
public function getReceiver(): int
|
|
{
|
|
return $this->receiver;
|
|
}
|
|
|
|
public function setSent(float $sent): self
|
|
{
|
|
$this->sent = $sent;
|
|
return $this;
|
|
}
|
|
|
|
public function getSent(): float
|
|
{
|
|
return $this->sent;
|
|
}
|
|
|
|
public function setActive(bool $active): self
|
|
{
|
|
$this->active = $active;
|
|
return $this;
|
|
}
|
|
|
|
public function getActive(): bool
|
|
{
|
|
return $this->active;
|
|
}
|
|
|
|
// @codeCoverageIgnoreEnd
|
|
// }}} Autocode
|
|
|
|
public static function schemaDef(): array
|
|
{
|
|
return [
|
|
'name' => 'webmonetization',
|
|
'fields' => [
|
|
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
|
|
'sender' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'many to one', 'not null' => true, 'description' => 'actor sending money'],
|
|
'receiver' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'many to one', 'not null' => true, 'description' => 'actor receiving money'],
|
|
'sent' => ['type' => 'float', 'not null' => true, 'description' => 'how much sender has sent to receiver'],
|
|
'active' => ['type' => 'bool', 'not null' => true, 'description' => 'whether it should donate'],
|
|
],
|
|
'primary key' => ['id'],
|
|
];
|
|
}
|
|
}
|