Advertisement
Guest User

Listener.php

a guest
Jan 24th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <?php
  2.  
  3. namespace apathy\UsernameStyles;
  4.  
  5. use XF\Mvc\Entity\Entity;
  6.  
  7. class Listener
  8. {
  9.  
  10. /* COLOR VALIDATION
  11. #([0-9a-fA-F]{3}){1,2} */
  12. public static function userEntityStructure(\XF\Mvc\Entity\Manager $em, \XF\Mvc\Entity\Structure &$structure)
  13. {
  14. /* Username styles */
  15. $structure->columns['ap_bold'] = ['type' => Entity::UINT, 'maxLength' => 3, 'default' => 0];
  16. $structure->columns['ap_color'] = ['type' => Entity::STR, 'maxLength' => 30, 'default' => false];
  17. $structure->columns['ap_glow'] = ['type' => Entity::STR, 'maxLength' => 90, 'default' => false];
  18. $structure->columns['ap_sparkle'] = ['type' => Entity::UINT, 'maxLength' => 3, 'default' => 0];
  19.  
  20. /* Avatar styles */
  21. $structure->columns['ap_frame'] = ['type' => Entity::STR, 'maxLength' => 15, 'default' => false];
  22.  
  23. $structure->relations['Username'] = [
  24. 'entity' => 'apathy\UsernameStyles:Username',
  25. 'type' => Entity::TO_ONE,
  26. 'conditions' => 'user_id',
  27. 'primary' => true
  28. ];
  29.  
  30. $structure->relations['Postbit'] = [
  31. 'entity' => 'apathy\UsernameStyles:Postbit',
  32. 'type' => Entity::TO_ONE,
  33. 'conditions' => 'user_id',
  34. 'primary' => true
  35. ];
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement