Advertisement
Guest User

Entity\Username.php

a guest
Jan 24th, 2021
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2.  
  3. namespace apathy\UsernameStyles\Entity;
  4.  
  5. use XF\Mvc\Entity\Structure;
  6.  
  7. class Username extends \XF\Mvc\Entity\Entity
  8. {
  9. public static function getStructure(Structure $structure)
  10. {
  11. $structure->table = 'xf_ap_username_styles';
  12. $structure->shortName = 'apathy\UsernameStyles:Username';
  13. $structure->primaryKey = 'style_id';
  14. $structure->columns = [
  15. 'style_id' => ['type' => self::UINT, 'required' => true],
  16. 'user_id' => ['type' => self::UINT, 'default' => 0],
  17. 'bold' => ['type' => self::UINT, 'maxLength' => 3, 'default' => 0],
  18. 'color' => ['type' => self::STR, 'maxLength' => 30, 'default' => false],
  19. 'glow' => ['type' => self::STR, 'maxLength' => 90, 'default' => false],
  20. 'sparkle' => ['type' => self::UINT, 'maxLength' => 3, 'default' => 0]
  21. ];
  22. $structure->getters = [];
  23. $structure->relations = [
  24. 'User' => [
  25. 'entity' => 'XF:User',
  26. 'type' => self::TO_ONE,
  27. 'conditions' => 'user_id',
  28. 'primary' => true
  29. ],
  30. ];
  31.  
  32. return $structure;
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement