gnu-social/plugins/AttachmentCollections/Entity/Collection.php

67 lines
1.6 KiB
PHP
Raw Normal View History

<?php
2021-12-26 09:48:16 +00:00
declare(strict_types = 1);
namespace Plugin\AttachmentCollections\Entity;
use App\Core\Entity;
2021-12-26 09:48:16 +00:00
class Collection 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 ?string $name;
private int $actor_id;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getId(): int
{
return $this->id;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setActorId(int $actor_id): self
{
$this->actor_id = $actor_id;
return $this;
}
public function getActorId(): int
{
return $this->actor_id;
}
// @codeCoverageIgnoreEnd
// }}} Autocode
public static function schemaDef()
{
return [
'name' => 'attachment_collection',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
2021-12-26 09:48:16 +00:00
'name' => ['type' => 'varchar', 'length' => 255, 'description' => 'collection\'s name'],
'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to many', 'not null' => true, 'description' => 'foreign key to actor table'],
],
2021-12-26 09:48:16 +00:00
'primary key' => ['id'],
];
}
}