<?php
namespace xxxxxxxxxxxxxxxxx;
use xxxxxxxxxxxx
class UserProfile extends Entity
{
use ReactionTrait;
public static function getStructure(Structure $structure): Structure
{
$structure->table = xxxxxxxxxx
//
$structure->columns = [
//
'profile_state' => [
'type' => self::STR, 'default' => 'visible',
'allowedValues' => ['visible', 'moderated', 'deleted'], 'api' => true
],
'reaction_score' => ['type' => self::UINT, 'default' => 0],
'reactions' => ['type' => self::JSON_ARRAY, 'default' => []],
'reaction_users' => ['type' => self::JSON_ARRAY, 'default' => []],
//
];
$structure->relations = [
'User' => [
'entity' => 'XF:User',
'type' => self::TO_ONE,
'conditions' => 'user_id',
'primary' => true
],
'Reactions' => [
'entity' => 'XF:ReactionContent',
'type' => self::TO_MANY,
'conditions' => [
['content_type', '=', $structure->contentType],
['content_id', '=', '$' . $structure->primaryKey]
],
'key' => 'reaction_user_id',
'order' => 'reaction_date'
]
];
$structure->defaultWith = [];
$structure->behaviors = [
'XF:Reactable' => ['stateField' => 'profile_state']
];
$structure->getters['reactions'] = true;
$structure->getters['reaction_users'] = true;
static::addReactableStructureElements($structure);
return $structure;
}
//
public function canReact(&$error = null) { // }
public function getReactUserId() { // }
}