我有一个使用 Symfony 用 PHP 编写的 Web 应用程序,我将它从本地计算机移动到远程服务器。当我尝试登录时,我收到了错误:
致命错误:AdminUserRole::getAccessibleEmployeeIds() 的声明必须与 AbstractUserRole::getAccessibleEmployeeIds() 的声明兼容
AdminUserRole 类
class AdminUserRole extends AbstractUserRole {
public function getAccessibleEmployeeIds($operation = null, $returnType = null, $requiredPermissions = array()) {
return $this->getEmployeeService()->getEmployeeIdList(false);
}
public function getAccessibleEmployeePropertyList($properties, $orderField, $orderBy, $requiredPermissions = array()) {
return $this->getEmployeeService()->getEmployeePropertyList($properties, $orderField, $orderBy, false);
}
public function getAccessibleEmployees($operation = null, $returnType = null, $requiredPermissions = array()) {
$employees = $this->getEmployeeService()->getEmployeeList('empNumber', 'ASC', true);
$employeesWithIds = array();
foreach ($employees as $employee) {
$employeesWithIds[$employee->getEmpNumber()] = $employee;
}
return $employeesWithIds;
}
public function getAccessibleLocationIds($operation, $returnType) {
$locations = $this->getLocationService()->getLocationList();
$ids = array();
foreach ($locations as $location) {
$ids[] = $location->getId();
}
return $ids;
}
public function getAccessibleOperationalCountryIds($operation, $returnType) {
$operationalCountries = $this->getOperationalCountryService()->getOperationalCountryList();
$ids = array();
foreach ($operationalCountries as $country) {
$ids[] = $country->getId();
}
return $ids;
}
public function getAccessibleSystemUserIds($operation, $returnType) {
return $this->getSystemUserService()->getSystemUserIdList();
}
public function getAccessibleUserRoleIds($operation, $returnType) {
$userRoles = $this->getSystemUserService()->getAssignableUserRoles();
$ids = array();
foreach ($userRoles as $role) {
$ids[] = $role->getId();
}
return $ids;
}
}
还有我的抽象课
abstract class AbstractUserRole {
protected $employeeService;
protected $systemUserService;
protected $operationalCountryService;
protected $locationService;
protected $userRoleManager;
protected $roleName;
public function __construct($roleName, $userRoleManager) {
$this->userRoleManager = $userRoleManager;
$this->roleName = $roleName;
}
public function getSystemUserService() {
if (empty($this->systemUserService)) {
$this->systemUserService = new SystemUserService();
}
return $this->systemUserService;
}
public function setSystemUserService($systemUserService) {
$this->systemUserService = $systemUserService;
}
public function getEmployeeService() {
if (empty($this->employeeService)) {
$this->employeeService = new EmployeeService();
}
return $this->employeeService;
}
public function setEmployeeService($employeeService) {
$this->employeeService = $employeeService;
}
public function getLocationService() {
if (empty($this->locationService)) {
$this->locationService = new LocationService();
}
return $this->locationService;
}
public function setLocationService($locationService) {
$this->locationService = $locationService;
}
public function getOperationalCountryService() {
if (empty($this->operationalCountryService)) {
$this->operationalCountryService = new OperationalCountryService();
}
return $this->operationalCountryService;
}
public function setOperationalCountryService($operationalCountryService) {
$this->operationalCountryService = $operationalCountryService;
}
public function getAccessibleEntities($entityType, $operation = null, $returnType = null, $requiredPermissions = array()) {
switch ($entityType) {
case 'Employee':
$entities = $this->getAccessibleEmployees($operation, $returnType, $requiredPermissions);
break;
}
return $entities;
}
public function getAccessibleEntityProperties($entityType, $properties = array(), $orderField = null, $orderBy = null, $requiredPermissions = array()) {
switch ($entityType) {
case 'Employee':
$propertyList = $this->getAccessibleEmployeePropertyList($properties, $orderField, $orderBy, $requiredPermissions);
break;
}
return $propertyList;
}
public function getAccessibleEntityIds($entityType, $operation = null, $returnType = null, $requiredPermissions = array()) {
switch ($entityType) {
case 'Employee':
$ids = $this->getAccessibleEmployeeIds($operation, $returnType, $requiredPermissions);
break;
case 'SystemUser':
$ids = $this->getAccessibleSystemUserIds($operation, $returnType);
break;
case 'OperationalCountry':
$ids = $this->getAccessibleOperationalCountryIds($operation, $returnType);
break;
case 'UserRole':
$ids = $this->getAccessibleUserRoleIds($operation, $returnType);
break;
case 'Location':
$ids = $this->getAccessibleLocationIds($operation, $returnType);
break;
}
return $ids;
}
public abstract function getAccessibleEmployees($operation = null, $returnType = null, $requiredPermissions = array());
public abstract function getAccessibleEmployeePropertyList($properties, $orderField, $orderBy, $requiredPermissions = array());
public abstract function getAccessibleEmployeeIds($operation, $returnType, $requiredPermissions = array());
public abstract function getAccessibleSystemUserIds($operation, $returnType);
public abstract function getAccessibleOperationalCountryIds($operation, $returnType);
public abstract function getAccessibleUserRoleIds($operation, $returnType);
public abstract function getAccessibleLocationIds($operation, $returnType);
}