From 4a8babb49e2040d77010540a79373176517c1dc4 Mon Sep 17 00:00:00 2001 From: cdplant <77061160+cdplant@users.noreply.github.com> Date: Mon, 12 Jul 2021 15:08:44 +0100 Subject: [PATCH] Add support for employee IDs in session attendace writebacks (#18) * Add support for employee IDs in session attendace writebacks * Update SessionAttendanceRecord.php Updated casing for consistency Co-authored-by: Darren Hodges --- src/Client.php | 2 +- src/Writeback/SessionAttendanceRecord.php | 37 +++++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/Client.php b/src/Client.php index 2be02f1..2bdc531 100644 --- a/src/Client.php +++ b/src/Client.php @@ -31,7 +31,7 @@ class Client /** * @var string */ - const version = '2.1.1'; + const version = '2.1.2'; /** * Client constructor. diff --git a/src/Writeback/SessionAttendanceRecord.php b/src/Writeback/SessionAttendanceRecord.php index 47616e7..d04f55f 100644 --- a/src/Writeback/SessionAttendanceRecord.php +++ b/src/Writeback/SessionAttendanceRecord.php @@ -11,6 +11,11 @@ class SessionAttendanceRecord */ private $student_id; + /** + * @var string + */ + private $employee_id; + /** * @var string */ @@ -39,7 +44,7 @@ class SessionAttendanceRecord /** * Set student id * - * @param string $date + * @param string $studentId * @return void * @throws InvalidAttendanceException */ @@ -52,6 +57,18 @@ public function setStudentId($studentId) $this->student_id = $studentId; } + /** + * Set employee id + * + * @param string $employeeId + * @return void + * @throws InvalidAttendanceException + */ + public function setEmployeeId($employeeId) + { + $this->employee_id = $employeeId; + } + /** * Set date * @@ -131,6 +148,16 @@ public function getStudentId() return $this->student_id; } + /** + * Return the student id + * + * @return string + */ + public function getEmployeeId() + { + return $this->employee_id; + } + /** * Return the date * @@ -180,6 +207,12 @@ public function toArray() if ( ! empty($comment)) { $required['comment'] = $comment; } + + $employeeId = $this->getEmployeeId(); + + if ( ! empty($employeeId)) { + $required['employee_id'] = $employeeId; + } $minutesLate = $this->getMinutesLate(); @@ -234,4 +267,4 @@ public function getMinutesLate() { return $this->minutesLate; } -} \ No newline at end of file +}