| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- /**
- * Game Server key entity file.
- *
- * Creates the entity and makes it available.
- *
- * @category Entity
- */
- /**
- * Require dependent entities if not present.
- */
- require_once(PATH::ENTITY . "Entity.php");
- /**
- * Game Server.
- *
- * Represents an object from the table 'server'.
- *
- * @category Entity
- */
- class Server extends Entity{
- /**
- * @var int Server identifier.
- */
- public $id;
- /**
- * @var string Server name.
- */
- public $name;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * server, populating it and it's items.
- *
- * @param int $id Server identifier.
- */
- public function __construct($id){
- $statement = get_context()->get_db()->prepare("
- SELECT
- id,
- name
- FROM server
- WHERE id = :id;
- ");
- $statement->bindValue(':id', $id, SQLITE3_TEXT);
- $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->id = $r["id"];
- $this->name = HTML::e($r["name"]);
- }
- }
- }
- ?>
|