Role.php 689 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. namespace OpenMind\System;
  4. use DB\SQL\Mapper;
  5. /**
  6. * Persistent role catalog mapper.
  7. *
  8. * @property int $id
  9. * @property string $name
  10. * @property string $description
  11. */
  12. class Role extends Mapper
  13. {
  14. private const TABLE_NAME = 'roles';
  15. /**
  16. * Initialize the role mapper and optionally load a matching record.
  17. *
  18. * @param string|array|null $where Optional mapper load condition.
  19. * @side-effects Connects the mapper to the configured database and may load a role.
  20. */
  21. public function __construct($where = null)
  22. {
  23. global $f3;
  24. parent::__construct($f3->get('DB'), self::TABLE_NAME);
  25. if ($where !== null) {
  26. $this->load($where);
  27. }
  28. }
  29. }