Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace apathy\UsernameStyles;
- use XF\Mvc\Entity\Entity;
- class Listener
- {
- /* COLOR VALIDATION
- #([0-9a-fA-F]{3}){1,2} */
- public static function userEntityStructure(\XF\Mvc\Entity\Manager $em, \XF\Mvc\Entity\Structure &$structure)
- {
- /* Username styles */
- $structure->columns['ap_bold'] = ['type' => Entity::UINT, 'maxLength' => 3, 'default' => 0];
- $structure->columns['ap_color'] = ['type' => Entity::STR, 'maxLength' => 30, 'default' => false];
- $structure->columns['ap_glow'] = ['type' => Entity::STR, 'maxLength' => 90, 'default' => false];
- $structure->columns['ap_sparkle'] = ['type' => Entity::UINT, 'maxLength' => 3, 'default' => 0];
- /* Avatar styles */
- $structure->columns['ap_frame'] = ['type' => Entity::STR, 'maxLength' => 15, 'default' => false];
- $structure->relations['Username'] = [
- 'entity' => 'apathy\UsernameStyles:Username',
- 'type' => Entity::TO_ONE,
- 'conditions' => 'user_id',
- 'primary' => true
- ];
- $structure->relations['Postbit'] = [
- 'entity' => 'apathy\UsernameStyles:Postbit',
- 'type' => Entity::TO_ONE,
- 'conditions' => 'user_id',
- 'primary' => true
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement