/** * Constructor * @param RoomChangeRequest $request * @param unknown $effectiveDate * @param unknown $effectiveUntilDate * @param unknown $committedBy */ public function __construct(RoomChangeParticipant $participant, $effectiveDate, $effectiveUntilDate = null, $committedBy) { $this->participantId = $participant->getId(); $this->effectiveDate = $effectiveDate; $this->effectiveUntilDate = $effectiveUntilDate; $this->committedBy = $committedBy; }
public static function getStateHistory(RoomChangeParticipant $participant) { $db = PdoFactory::getPdoInstance(); $query = "SELECT * FROM hms_room_change_participant_state WHERE participant_id = :participantId ORDER BY effective_date ASC"; $stmt = $db->prepare($query); $stmt->execute(array('participantId' => $participant->getId())); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); // If no results, just return here if (sizeof($results) <= 0) { return null; } // Create a ParticipantState object for each result $states = array(); foreach ($results as $row) { $className = 'ParticipantState' . $row['state_name']; $states[] = new $className($participant, $row['effective_date'], $row['effective_until_date'], $row['committed_by']); } return $states; }