User assignment
Table of contents
See how to create a $factory
List user assignments
Returns a list of all user assignments
Usage
$response = $factory->projects()->userAssignments()->listUserAssignments($isActive, $updatedSince, $meta);
$meta = $response->getMeta();
$meta instanceof \Lsv\TimeharvestSdk\Response\MetaResponse
foreach ($response->getData() as $client) {
$client instanceof \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData
}
Parameters
Parameter |
Required |
Type |
Description |
$isActive |
false |
bool |
Select only active or inactive clients |
$updatedSince |
false |
DateTimeInterface |
Only select clients updated after this date |
$meta |
false |
\Lsv\TimeharvestSdk\Response\MetaResponse |
Pagination |
Response
$response->getMeta() instanceof \Lsv\TimeharvestSdk\Response\MetaResponse;
$response->getData() array of \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData
List user assignments by project
Returns a list of all user assignments for a project
Usage
$response = $factory->projects()->userAssignments()->listUserAssignmentsForProject($project, $isActive, $updatedSince, $meta);
$meta = $response->getMeta();
$meta instanceof \Lsv\TimeharvestSdk\Response\MetaResponse
foreach ($response->getData() as $client) {
$client instanceof \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData
}
Parameters
Parameter |
Required |
Type |
Description |
$project |
true |
int | \Lsv\TimeharvestSdk\Response\Project\ProjectData |
The ID or a ProjectData of the tasks assigned to this project |
$isActive |
false |
bool |
Select only active or inactive clients |
$updatedSince |
false |
DateTimeInterface |
Only select clients updated after this date |
$meta |
false |
\Lsv\TimeharvestSdk\Response\MetaResponse |
Pagination |
Response
$response->getMeta() instanceof \Lsv\TimeharvestSdk\Response\MetaResponse;
$response->getData() array of \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData
Retrieve user assignment
Usage
$response = $factory->projects()->userAssignments()->retrieveUserAssignment($project, $assignment);
Parameters
Parameter |
Required |
Type |
Description |
$project |
true |
int | \Lsv\TimeharvestSdk\Response\Project\ProjectData |
The ID or a ProjectData of the project needed to be retrieved |
$assignment |
true |
int | \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData |
The UserAssignmentData that needed to be retrieved |
Response
$response->getData() instanceof \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData
Create user assignment
Usage
$dto = new \Lsv\TimeharvestSdk\Dto\Projects\UserAssignments\CreateUserAssignmentDto(
$user,
$isActive,
$isProjectManager,
$useDefaultRates,
$hourlyRate,
$budget,
);
$response = $factory->projects()->userAssignments()->createTaskAssignment($project, $dto);
Parameters
Parameter |
Required |
Type |
Description |
$project |
true |
int | \Lsv\TimeharvestSdk\Response\Project\ProjectData |
The ID or a ProjectData of the tasks assigned to this project |
$user |
true |
int | \Lsv\TimeharvestSdk\Response\User\UserData |
The user to associate with the project. |
$isActive |
false |
boolean |
Whether the user assignment is active or archived. |
$isProjectManager |
false |
boolean |
Determines if the user has Project Manager permissions for the project. |
$useDefaultRates |
false |
boolean |
Determines which billable rate(s) will be used on the project for this user |
$hourlyRate |
false |
float |
Custom rate used |
$budget |
false |
float |
Budget used when the project’s |
Response
$response->getData() instanceof \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData
Update user assignment
Usage
$dto = new \Lsv\TimeharvestSdk\Dto\Projects\UserAssignments\UpdateUserAssignmentDto(
$isActive,
$isProjectManager,
$useDefaultRates,
$hourlyRate,
$budget,
);
$response = $factory->projects()->userAssignments()->updateUserAssignment($project, $assignment, $dto);
Parameters
Parameter |
Required |
Type |
Description |
$project |
true |
int | \Lsv\TimeharvestSdk\Response\Project\ProjectData |
The ID or a ProjectData of the project needed to be created with this task |
$assignment |
true |
int | \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData |
The assignment to be updated |
$isActive |
false |
boolean |
Whether the user assignment is active or archived. |
$isProjectManager |
false |
boolean |
Determines if the user has Project Manager permissions for the project. |
$useDefaultRates |
false |
boolean |
Determines which billable rate(s) will be used on the project for this user |
$hourlyRate |
false |
float |
Custom rate used |
$budget |
false |
float |
Budget used when the project’s |
Response
$response->getData() instanceof \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData
Delete user assignment
Usage
$factory->projects()->userAssignments()->deleteUserAssignment($project, $assignment);
Parameters
Parameter |
Required |
Type |
Description |
$project |
true |
int | \Lsv\TimeharvestSdk\Response\Project\ProjectData |
The ID or a ProjectData of the project needed to be created with this task |
$assignment |
true |
int | \Lsv\TimeharvestSdk\Response\Project\UserAssignment\UserAssignmentData |
The assignment to be updated |