#7914 - Fix for contacts being empty or s tring (#7915)
[openemr.git] / src / Events / Patient / PatientBeforeCreatedAuxEvent.php
blob5f1e9e1c50d689c4a9c88ae68cdefea28f7a9614
1 <?php
3 /**
4 * BeforePatientCreatedAuxEvent
6 * This event is fired before a patient is created so modules can
7 * listen for creation of a patient and perform additional
8 * processing, or modify insert data.
10 * The difference between this event and BeforePatientCreatedEvent
11 * is that, it'll give users who attach different tables to the
12 * without saving in the patient_data table save their records as well.
14 * @package OpenEMR
15 * @link https://www.open-emr.org
16 * @author Kofi Appiah <kkappiah@medsov.com>
17 * @copyright Copyright (c) 2024 Omegasystems Group <info@omegasystemsgroup.com>
18 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
21 namespace OpenEMR\Events\Patient;
23 use Symfony\Contracts\EventDispatcher\Event;
25 class PatientBeforeCreatedAuxEvent extends Event
27 /**
28 * This event is triggered before a patient has been created, and an assoc
29 * array of new patient data is passed to the event object
31 const EVENT_HANDLE = 'patient.before-created-aux';
33 private $patientData;
34 private $pid;
36 /**
37 * BeforePatientUpdatedEvent constructor takes an array
38 * of key/value pairs that represent fields of the patient_data
39 * table
41 * @param array $patientData
43 public function __construct($pid, array $patientData)
45 $this->patientData = $patientData;
46 $this->pid = $pid;
49 /**
50 * @return mixed
52 public function getPatientData()
54 $pid = array('pid' => $this->pid);
55 $this->patientData = array_merge($pid, $this->patientData);
57 return $this->patientData;
60 /**
61 * @param mixed $patientData
62 * @param $pid
64 public function setPatientData($pid, array $patientData): void
66 $this->patientData = $patientData;