Documentation

EmployeesController extends BasePrivateApiController

Tags
Path

("/employees") Class EmployeesController

category
subpackage

Api\Controllers

Table of Contents

$container  : Container
$database  : Explorer
$translator  : Translator
$authManager  : Identity|object|null
$employeeManager  : EmployeesManager
$hookManager  : ModelHooks
$metaManager  : MetaManager
$structureManager  : StructuresManager
$tagManager  : TagsManager
__construct()  : mixed
create()  : ApiResponse
add new employees from json object
delete()  : ApiResponse
getById()  : ApiResponse
index()  : ApiResponse
return employee list
search()  : ApiResponse
update()  : ApiResponse
update employee
findEmployee()  : Row|null
find employee by any identity
getByExternalId()  : ApiResponse
return employee json object by external id
getByUuid()  : ApiResponse
return employee json object by uuid
getEmployeeArray()  : array<string|int, mixed>|array<string|int, array<string|int, mixed>>|null
return array employee for json encode
getSearchQuery()  : string
build query string from filter employees
updateEmployee()  : array<string|int, mixed>
update employee

Properties

Methods

__construct()

public __construct(Container $container, Explorer $database) : mixed
Parameters
$container : Container
$database : Explorer
Return values
mixed

create()

add new employees from json object

public create(ApiRequest $request, ApiResponse $response) : ApiResponse
Parameters
$request : ApiRequest
$response : ApiResponse
Tags
Path

("/")

Method

("POST")

OpenApi

(" summary: add new employee operationId: object employee

tags: - employee requestBody: description: Optional description in Markdown required: true content: application/json: schema: type: object properties: employees: type: array summary: array employees items: type: object properties: title: type: string format: string summary: Name Family structure_id: type: integer format: int32 summary: structures id external_id: type: string format: string summary: employee id from another system number: type: integer format: int32 summary: number employee is_fired: type: boolean summary: true if employee if fired or false if not fired_dt: type: string format: string summary: date fired employee in format Y-m-dTH:m:s position: type: array summary: position employee items: summary: name position employee type: string format: string structure: type: object properties: company: type: string format: string summary: Title company workshop: type: string format: string summary: Title workshop division: type: string format: string summary: Title division examples: employee: summary: example employee input json value: title: Иванов Ивано Иванович structure_id: 1 external_id: 02106c93-8b32-48c4-9284-88990fc23a85 number: 1278 is_fired: true fired_dt: 2021-05-12T16:00:00 position: Слесарь

responses: '200': description: return new employee as json object content: application/json: schema: type: object properties: employees: type: array summary: array employees items: type: object properties: id: type: integer format: int32 summary: id employee in system uuid: type: string format: string summary: uuid employee in system title: type: string format: string summary: Name Family structure_id: type: integer format: int32 summary: structures id external_id: type: string format: string summary: employee id from another system number: type: integer format: int32 summary: number employee is_fired: type: boolean summary: true if employee if fired or false if not fired_dt: type: string format: string summary: date fired employee in format Y-m-dTH:m:s position: type: array summary: position employee items: summary: name position employee type: string format: string

")

throws
NotAllPropertySetException
throws
JsonException
throws
JsonException
Return values
ApiResponse

delete()

public delete(ApiRequest $request, ApiResponse $response) : ApiResponse
Parameters
$request : ApiRequest
$response : ApiResponse
Tags
throws
EmployeeUseException
throws
JsonException
Return values
ApiResponse

getById()

public getById(ApiRequest $request, ApiResponse $response) : ApiResponse
Parameters
$request : ApiRequest
$response : ApiResponse
Tags
Path

("/get")

Method

("GET")

OpenApi

(" summary: return employee as json object by id operationId: object employee tags: - employee parameters: - name: id in: query description: id employee required: false schema: type: integer format: int32 - name: uuid in: query description: uuid employee required: false schema: type: string format: string - name: external_id in: query description: external_id employee required: false schema: type: string format: string responses: '200': description: return new employee as json object content: application/json: schema: type: object properties: id: type: integer format: int32 summary: id employee in system uuid: type: string format: string summary: uuid employee in system title: type: string format: string summary: Name Family structure_id: type: integer format: int32 summary: structures id external_id: type: string format: string summary: employee id from another system number: type: integer format: int32 summary: number employee is_fired: type: boolean summary: true if employee if fired or false if not fired_dt: type: string format: string summary: date fired employee in format Y-m-dTH:m:s position: type: array summary: position employee items: summary: name position employee type: string format: string

")

throws
JsonException
Return values
ApiResponse

index()

return employee list

public index(ApiRequest $request, ApiResponse $response) : ApiResponse
Parameters
$request : ApiRequest
$response : ApiResponse
Tags
Path

("/")

Method

("GET")

throws
JsonException
throws
TagGroupNotFoundException
Return values
ApiResponse
public search(ApiRequest $request, ApiResponse $response) : ApiResponse
Parameters
$request : ApiRequest
$response : ApiResponse
Tags
Path

("/search")

Method

("GET")

OpenApi

(" summary: return employee as json object by any params operationId: object employee tags: - employee parameters: - name: title in: query description: Partial or complete employee title required: false schema: type: string format: string - name: structure_id in: query description: Structure identifier required: false schema: type: integer format: int32 - name: pageLimit in: query description: Limit employees on one page required: false schema: type: integer format: int32 - name: pageNumber in: query description: number of page required: false schema: type: integer format: int32 - name: other in: query description: For sortind you can use any other properties of objects except for uuid id external_id required: false schema: type: string format: string responses: '200': description: return a list of employee content: application/json: schema: type: array items: type: object properties: id: type: integer format: int32 summary: id employee in system uuid: type: string format: string summary: uuid employee in system title: type: string format: string summary: Name Family structure_id: type: integer format: int32 summary: structures id external_id: type: string format: string summary: employee id from another system number: type: integer format: int32 summary: number employee is_fired: type: boolean summary: true if employee if fired or false if not fired_dt: type: string format: string summary: date fired employee in format Y-m-dTH:m:s position: type: array summary: position employee items: summary: name position employee type: string format: string ")

throws
JsonException
Return values
ApiResponse

update()

update employee

public update(ApiRequest $request, ApiResponse $response) : ApiResponse
Parameters
$request : ApiRequest
$response : ApiResponse
Tags
Path

("/update")

Method

("POST")

OpenApi

(" summary: update employee operationId: object employee tags: - employee requestBody: description: Optional description in Markdown required: true content: application/json: schema: type: object properties: id: type: integer format: int32 summary: id employee in system uuid: type: string format: string summary: uuid employee in system title: type: string format: string summary: Name Family structure_id: type: integer format: int32 summary: structures id external_id: type: string format: string summary: employee id from another system number: type: integer format: int32 summary: number employee is_fired: type: boolean summary: true if employee if fired or false if not fired_dt: type: string format: string summary: date fired employee in format Y-m-dTH:m:s position: type: array summary: position employee items: summary: name position employee type: string format: string responses: '200': description: return new employee as json object content: application/json: schema: type: object properties: id: type: integer format: int32 summary: id employee in system uuid: type: string format: string summary: uuid employee in system title: type: string format: string summary: Name Family structure_id: type: integer format: int32 summary: structures id external_id: type: string format: string summary: employee id from another system number: type: integer format: int32 summary: number employee is_fired: type: boolean summary: true if employee if fired or false if not fired_dt: type: string format: string summary: date fired employee in format Y-m-dTH:m:s position: type: array summary: position employee items: summary: name position employee type: string format: string ")

throws
TagGroupNotFoundException
throws
TagInsertFail
throws
TagInvalidUuid
throws
JsonException
throws
StructureNotFoundException
Return values
ApiResponse

findEmployee()

find employee by any identity

private findEmployee( $identifier) : Row|null
Parameters
$identifier :
Return values
Row|null

getByExternalId()

return employee json object by external id

private getByExternalId(ApiRequest $request, ApiResponse $response) : ApiResponse
Parameters
$request : ApiRequest
$response : ApiResponse
Tags
throws
JsonException
Return values
ApiResponse

getByUuid()

return employee json object by uuid

private getByUuid(ApiRequest $request, ApiResponse $response) : ApiResponse
Parameters
$request : ApiRequest
$response : ApiResponse
Tags
throws
JsonException
Return values
ApiResponse

getEmployeeArray()

return array employee for json encode

private getEmployeeArray( $ids) : array<string|int, mixed>|array<string|int, array<string|int, mixed>>|null
Parameters
$ids :
Tags
throws
StructureNotFoundException
Return values
array<string|int, mixed>|array<string|int, array<string|int, mixed>>|null

getSearchQuery()

build query string from filter employees

private getSearchQuery( $params) : string
Parameters
$params :
Tags
throws
Exception
Return values
string

updateEmployee()

update employee

private updateEmployee( $id,  $employee,  $employeeDataArray) : array<string|int, mixed>
Parameters
$id :
$employee :
$employeeDataArray :
Tags
throws
TagInsertFail
throws
TagInvalidUuid
Return values
array<string|int, mixed>

Search results