2021-12-24 09:38:06 +09:00
< ? php
2021-12-26 18:48:16 +09:00
declare ( strict_types = 1 );
2021-12-30 09:51:12 +09:00
namespace Plugin\AttachmentCollections\Entity ;
2021-12-24 09:38:06 +09:00
use App\Core\Entity ;
2021-12-28 13:39:09 +09:00
use function mb_substr ;
2021-12-26 18:48:16 +09:00
2021-12-30 09:51:12 +09:00
class AttachmentCollection extends Entity
2021-12-24 09:38:06 +09:00
{
// 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 ;
2021-12-28 13:39:09 +09:00
private string $name ;
2021-12-24 09:38:06 +09:00
private int $actor_id ;
public function setId ( int $id ) : self
{
$this -> id = $id ;
return $this ;
}
public function getId () : int
{
return $this -> id ;
}
2021-12-28 13:39:09 +09:00
public function setName ( string $name ) : self
2021-12-24 09:38:06 +09:00
{
2021-12-28 13:39:09 +09:00
$this -> name = mb_substr ( $name , 0 , 255 );
2021-12-24 09:38:06 +09:00
return $this ;
}
2021-12-28 13:39:09 +09:00
public function getName () : string
2021-12-24 09:38:06 +09:00
{
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
2022-03-08 09:21:12 +09:00
public static function schemaDef () : array
2021-12-24 09:38:06 +09:00
{
return [
2022-02-05 01:03:49 +09:00
'name' => 'attachment_collection' ,
2021-12-24 09:38:06 +09:00
'fields' => [
'id' => [ 'type' => 'serial' , 'not null' => true , 'description' => 'unique identifier' ],
2021-12-28 13:39:09 +09:00
'name' => [ 'type' => 'varchar' , 'length' => 255 , 'not null' => true , 'description' => 'collection\'s name' ],
2021-12-24 09:38:06 +09:00
'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 18:48:16 +09:00
'primary key' => [ 'id' ],
2021-12-24 09:38:06 +09:00
];
}
}