IDatabaseObject.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /*
  3. * Part of Shuzanne - An extensible sequel to an open-source imageboard.
  4. *
  5. * @package Shuzanne
  6. * @author MisleadingName, Shuzanne Contributors
  7. * @license MPL v2.0
  8. *
  9. * This Source Code Form is subject to the terms of the Mozilla Public
  10. * License, v. 2.0. If a copy of the MPL was not distributed with this
  11. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
  12. */
  13. namespace app\Interfaces;
  14. /*
  15. * Objects that implement this interface can be stored in the database.
  16. */
  17. interface IDatabaseObject
  18. {
  19. /**
  20. * Creates the table for the object type in the database.
  21. */
  22. public static function CreateTable(): void;
  23. /**
  24. * Drops the table for the object type from the database.
  25. */
  26. public static function DropTable(): void;
  27. /**
  28. * Saves the object to the database.
  29. */
  30. public function Save();
  31. /**
  32. * Deletes the object from the database.
  33. */
  34. public function Delete();
  35. /**
  36. * Loads the object from the database.
  37. */
  38. public function Load();
  39. /**
  40. * Loads multiple objects from the database.
  41. */
  42. public function LoadMany();
  43. }