RisteDimitrievski
Active member
I got errors in admin control panel when i try to use users functions like search, display all members etc.
In my entities are the following:
UserGroup entity;
PHP:
InvalidArgumentException: Unknown column title on XF:UserGroup in src\XF\Mvc\Entity\Finder.php at line 1640
PHP:
<?php
namespace usergrouplegend\Entity;
use usergrouplegend\XF\Entity\XFCP_User;
use XF\Mvc\Entity\Structure;
class User extends XFCP_User {
public static function getStructure(Structure $structure){
$structure = parent::getStructure($structure);
$structure->table = 'xf_user';
//$structure->columns['user_group_id'] = ['type' => self::INT, 'default' => null, 'changeLog' => false];
$structure->contentType = null;
$structure->relations += [
'Group' => [
'entity' => 'usergrouplegend:UserGroup',
'type' => self::TO_ONE,
'conditions' => 'user_group_id',
'primary' => true
]
];
return $structure;
}
PHP:
<?php
namespace usergrouplegend\Entity;;
use usergrouplegend\XF\Entity\XFCP_UserGroup;
use \XF\Mvc\Entity\Structure;
class UserGroup extends XFCP_UserGroup{
public static function getStructure(Structure $structure){
$structure = parent::getStructure($structure);
$structure->table = 'xf_user_group';
$structure->getters = [
'PermissionSet' => [
'getter' => true,
'cache' => true,
'setter' => true
]
];
$structure->primaryKey = 'user_group_id';
$structure->contentType = null;
$structure->columns['user_group_id'] = ['type' => self::INT, 'autoIncrement' => true, 'default' => null, 'changeLog' => false];
$structure->relations = [
'Users' => [
'entity' => 'usergrouplegend:User',
'type' => self::TO_ONE,
'conditions' => 'user_group_id',
'primary' => false
]
];
return $structure;
}
public function hasPermission($group,$permission){
return $this->PermissionSet->hasGlobalPermission($group,$permission);
}
}