. // }}} namespace App\Entity; use App\Core\Entity; use DateTimeInterface; /** * Entity for languages * * @category DB * @package GNUsocial * * @author Hugo Sales * @copyright 2021 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ class Language extends Entity { // {{{ Autocode // @codeCoverageIgnoreStart private int $id; private string $language; private DateTimeInterface $created; public function setId(int $id): self { $this->id = $id; return $this; } public function getId(): int { return $this->id; } public function setLanguage(string $language): self { $this->language = $language; return $this; } public function getLanguage(): string { return $this->language; } public function setCreated(DateTimeInterface $created): self { $this->created = $created; return $this; } public function getCreated(): DateTimeInterface { return $this->created; } // @codeCoverageIgnoreEnd // }}} Autocode public function __toString() { return $this->getLanguage(); } public static function schemaDef(): array { return [ 'name' => 'language', 'description' => 'all known languages', 'fields' => [ 'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'], 'language' => ['type' => 'char', 'length' => 64, 'description' => 'The locale identifier for the language of a note. 2-leter-iso-language-code_4-leter-script-code_2-leter-iso-country-code, but kept longer in case we get a different format'], 'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'], ], 'primary key' => ['id'], 'unique keys' => [ 'language_language_uniq' => ['language'], ], 'indexes' => [ 'language_idx' => ['language'], ], ]; } }