Completed
Push — master ( 17af13...acdc2b )
by Andrzej
02:44
created
scripts/migrate_patients.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
 use Hospitalplugin\Entities\PatientZZ;
25 25
 use Punction\DB\DoctrineBootstrap;
26 26
 
27
-if (! defined ( 'ABSPATH' )) {
28
-	define ( 'WP_USE_THEMES', false );
27
+if (!defined('ABSPATH')) {
28
+	define('WP_USE_THEMES', false);
29 29
 	require ('/var/www/wp/wp-load.php');
30 30
 }
31 31
 require_once ('/var/www/vendor/autoload.php');
32
-Logger::configure ( '../resources/log4php.xml' );
32
+Logger::configure('../resources/log4php.xml');
33 33
 /**
34 34
  * migration log4php logger
35 35
  */
36
-$log = Logger::getLogger ( "migration" );
37
-$log->info ( "Start!" );
36
+$log = Logger::getLogger("migration");
37
+$log->info("Start!");
38 38
 
39 39
 global $wpdb;
40 40
 /**
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 $error = "Error: the query failed...";
58 58
 /**
59 59
  */
60
-$results = $wpdb->get_results ( $query, ARRAY_A ) || wp_die ( $error );
60
+$results = $wpdb->get_results($query, ARRAY_A) || wp_die($error);
61 61
 
62
-$db1 = new DoctrineBootstrap ();
63
-$entityManager = $db1->getEntityManager ();
62
+$db1 = new DoctrineBootstrap();
63
+$entityManager = $db1->getEntityManager();
64 64
 
65
-foreach ( $results as $result ) {
65
+foreach ($results as $result) {
66 66
 	/**
67 67
 	 */
68 68
 	$id = $result ['ID'];
@@ -71,65 +71,65 @@  discard block
 block discarded – undo
71 71
 	$title = $result ['post_title'];
72 72
 	/**
73 73
 	 */
74
-	$pesel = implode ( get_post_meta ( $id, 'pesel' ) );
74
+	$pesel = implode(get_post_meta($id, 'pesel'));
75 75
 	/**
76 76
 	 */
77
-	$oddzid = implode ( get_post_meta ( $id, 'oddzial.ID' ) );
77
+	$oddzid = implode(get_post_meta($id, 'oddzial.ID'));
78 78
 	/**
79 79
 	 */
80 80
 	
81
-	$numer_historii = implode ( get_post_meta ( $id, 'numer_ksiegi_glownej' ) );
81
+	$numer_historii = implode(get_post_meta($id, 'numer_ksiegi_glownej'));
82 82
 	/**
83 83
 	 */
84
-	$data_kategoryzacji = implode ( get_post_meta ( $id, 'data_kategoryzacji' ) );
84
+	$data_kategoryzacji = implode(get_post_meta($id, 'data_kategoryzacji'));
85 85
 	/**
86 86
 	 */
87
-	$kategoria_pacjenta = implode ( get_post_meta ( $id, 'kategoria_pacjenta' ) );
87
+	$kategoria_pacjenta = implode(get_post_meta($id, 'kategoria_pacjenta'));
88 88
 	/**
89 89
 	 */
90
-	$aktywnosc_fizyczna = implode ( get_post_meta ( $id, '1_aktywnosc_fizyczna' ) );
90
+	$aktywnosc_fizyczna = implode(get_post_meta($id, '1_aktywnosc_fizyczna'));
91 91
 	/**
92 92
 	 */
93
-	$higiena = implode ( get_post_meta ( $id, '2_higiena' ) );
93
+	$higiena = implode(get_post_meta($id, '2_higiena'));
94 94
 	/**
95 95
 	 */
96
-	$odzywianie = implode ( get_post_meta ( $id, '3_odzywianie' ) );
96
+	$odzywianie = implode(get_post_meta($id, '3_odzywianie'));
97 97
 	/**
98 98
 	 */
99
-	$wydalanie = implode ( get_post_meta ( $id, '4_wydalanie' ) );
99
+	$wydalanie = implode(get_post_meta($id, '4_wydalanie'));
100 100
 	/**
101 101
 	 */
102
-	$pomiar_objawow_zyciowych = implode ( get_post_meta ( $id, '5_pomiar_objawow_zyciowych' ) );
102
+	$pomiar_objawow_zyciowych = implode(get_post_meta($id, '5_pomiar_objawow_zyciowych'));
103 103
 	/**
104 104
 	 */
105
-	$leczenie = implode ( get_post_meta ( $id, '6_leczenie' ) );
105
+	$leczenie = implode(get_post_meta($id, '6_leczenie'));
106 106
 	/**
107 107
 	 */
108
-	$edukacja_i_wsparcie_psychiczne = implode ( get_post_meta ( $id, '7_edukacja_i_wsparcie_psychiczne' ) );
108
+	$edukacja_i_wsparcie_psychiczne = implode(get_post_meta($id, '7_edukacja_i_wsparcie_psychiczne'));
109 109
 	
110 110
 	/**
111 111
 	 */
112
-	$patient = new PatientZZ ();
113
-	$patient->setName ( $title );
112
+	$patient = new PatientZZ();
113
+	$patient->setName($title);
114 114
 	if ($data_kategoryzacji == null) {
115
-		$log->warn ( "Patient " . $id . " missing date. Omitting." );
115
+		$log->warn("Patient ".$id." missing date. Omitting.");
116 116
 		continue;
117 117
 	}
118
-	$patient->setDataKategoryzacji ( \DateTime::createFromFormat ( "d-m-Y", $data_kategoryzacji ) );
119
-	$patient->setOddzialId ( $oddzid );
120
-	$patient->setNumerHistorii ( $numer_historii );
118
+	$patient->setDataKategoryzacji(\DateTime::createFromFormat("d-m-Y", $data_kategoryzacji));
119
+	$patient->setOddzialId($oddzid);
120
+	$patient->setNumerHistorii($numer_historii);
121 121
 	
122
-	$patient->setPesel ( $pesel );
123
-	$patient->setKategoriaPacjenta ( $kategoria_pacjenta );
124
-	$patient->setAktywnoscFizyczna ( $aktywnosc_fizyczna );
125
-	$patient->setHigiena ( $higiena );
126
-	$patient->setOdzywianie ( $odzywianie );
127
-	$patient->setWydalanie ( $wydalanie );
128
-	$patient->setPomiarObjawowZyciowych ( $pomiar_objawow_zyciowych );
129
-	$patient->setLeczenie ( $leczenie );
130
-	$patient->setEdukacjaIWsparciePsychiczne ( $edukacja_i_wsparcie_psychiczne );
122
+	$patient->setPesel($pesel);
123
+	$patient->setKategoriaPacjenta($kategoria_pacjenta);
124
+	$patient->setAktywnoscFizyczna($aktywnosc_fizyczna);
125
+	$patient->setHigiena($higiena);
126
+	$patient->setOdzywianie($odzywianie);
127
+	$patient->setWydalanie($wydalanie);
128
+	$patient->setPomiarObjawowZyciowych($pomiar_objawow_zyciowych);
129
+	$patient->setLeczenie($leczenie);
130
+	$patient->setEdukacjaIWsparciePsychiczne($edukacja_i_wsparcie_psychiczne);
131 131
 	
132
-	$entityManager->persist ( $patient );
132
+	$entityManager->persist($patient);
133 133
 }
134
-$entityManager->flush ();
135
-$log->info ( "Stop!" );
134
+$entityManager->flush();
135
+$log->info("Stop!");
Please login to merge, or discard this patch.
src/Entities/HospitalForm.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -33,27 +33,27 @@
 block discarded – undo
33 33
 class HospitalForm {
34 34
 	public static function load($yaml, $class, $dir) {
35 35
 		try {
36
-			$em = DoctrineBootstrap::getEntityManager ();
36
+			$em = DoctrineBootstrap::getEntityManager();
37 37
 			
38
-			$userId = $userId = wp_get_current_user ()->ID;
39
-			$ward = WardCRUD::getWardForUser ( $userId );
40
-			$user = $em->find ( "\Hospitalplugin\Entities\User", $userId );
38
+			$userId = $userId = wp_get_current_user()->ID;
39
+			$ward = WardCRUD::getWardForUser($userId);
40
+			$user = $em->find("\Hospitalplugin\Entities\User", $userId);
41 41
 			
42
-			if (! empty ( $_POST )) {
42
+			if (!empty ($_POST)) {
43 43
 				$args = $_POST;
44
-				$i = new $class ( $args );
45
-				$i->setWard ( $ward );
46
-				$i->setUser ( $user );
47
-				$em->persist ( $i );
48
-				$em->flush ();
44
+				$i = new $class($args);
45
+				$i->setWard($ward);
46
+				$i->setUser($user);
47
+				$em->persist($i);
48
+				$em->flush();
49 49
 			} else {
50
-				$object = \Hospitalplugin\utils\YAML2Object::getObject ( $yaml );
51
-				echo PLTwig::load ( $dir )->render ( 'form.twig', array (
50
+				$object = \Hospitalplugin\utils\YAML2Object::getObject($yaml);
51
+				echo PLTwig::load($dir)->render('form.twig', array(
52 52
 						'infections' => $object 
53
-				) );
53
+				));
54 54
 			}
55
-		} catch ( Exception $e ) {
56
-			echo "ERR: " . $e;
55
+		} catch (Exception $e) {
56
+			echo "ERR: ".$e;
57 57
 		}
58 58
 	}
59 59
 }
Please login to merge, or discard this patch.
src/Entities/InfectionRaport.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 	protected $user;
71 71
 	
72 72
 	function __construct($args) {
73
-		foreach ( $args as $key => $value ) {
73
+		foreach ($args as $key => $value) {
74 74
 			if ($key == 'dataRaportu') {
75
-				$value = new \DateTime ( $value );
75
+				$value = new \DateTime($value);
76 76
 			} 
77
-			call_user_func ( array (
77
+			call_user_func(array(
78 78
 					$this,
79
-					'set' . $key 
80
-			), $value );
79
+					'set'.$key 
80
+			), $value);
81 81
 		}
82
-		$this->dataPrzeslania = new \DateTime ();
82
+		$this->dataPrzeslania = new \DateTime();
83 83
 		echo '<h3><div class="alert alert-primary">Dziękuję za przesłanie raportu!</div></h3>';
84 84
 	}
85 85
 	
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 	 * @return string
112 112
 	 */
113 113
 	public function toString() {
114
-		$txt = $this->getId ();
115
-		$data = $this->getDataRaportu ();
114
+		$txt = $this->getId();
115
+		$data = $this->getDataRaportu();
116 116
 		if ($data instanceof \DateTime) {
117
-			$txt .= $this->getDataRaportu ()->format ( "Y-m-d" );
117
+			$txt .= $this->getDataRaportu()->format("Y-m-d");
118 118
 		} else {
119
-			$txt .= $this->getDataRaportu ();
119
+			$txt .= $this->getDataRaportu();
120 120
 		}
121 121
 		return $txt;
122 122
 	}
Please login to merge, or discard this patch.
src/Entities/Infections.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -250,7 +250,7 @@
 block discarded – undo
250 250
 		return $this;
251 251
 	}
252 252
 	public static function getFields() {
253
-		return array (
253
+		return array(
254 254
 				"Data raportu" => "dataRaportu",
255 255
 				"Oddział" => "ward",
256 256
 				"G" => "G",
Please login to merge, or discard this patch.
src/Entities/InfectionsCRUD.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -29,33 +29,33 @@
 block discarded – undo
29 29
 
30 30
 class InfectionsCRUD {
31 31
 	public static function getInfections($from, $to, $wardId, $class) {
32
-		$em = ( object ) DoctrineBootstrap::getEntityManager ();
33
-		$qb = $em->createQueryBuilder ();
34
-		$qb->select ( 'i' )->from ( 'Hospitalplugin\Entities\\' . $class, 'i' ) /* */
35
-        ->addOrderBy ( 'i.dataRaportu', 'DESC' ) /* */
36
-        ->addOrderBy ( 'i.dataPrzeslania ', 'DESC' ) /* */
37
-        ->where ( /* */
38
-        		$qb->expr ()->between ( 'i.dataRaportu', ':from', ':to' ) ) /* */
39
-        		->setParameters ( array (
32
+		$em = (object) DoctrineBootstrap::getEntityManager();
33
+		$qb = $em->createQueryBuilder();
34
+		$qb->select('i')->from('Hospitalplugin\Entities\\'.$class, 'i') /* */
35
+        ->addOrderBy('i.dataRaportu', 'DESC') /* */
36
+        ->addOrderBy('i.dataPrzeslania ', 'DESC') /* */
37
+        ->where( /* */
38
+        		$qb->expr()->between('i.dataRaportu', ':from', ':to') ) /* */
39
+        		->setParameters(array(
40 40
 				'from' => $from,
41 41
 				'to' => $to 
42
-		) );
42
+		));
43 43
 		if ($wardId != 'all') {
44
-			$qb->andWhere ( $qb->expr ()->eq ( 'i.ward', ':ward' ) ) /* */
45
-        			->setParameter ( 'ward', $wardId );
44
+			$qb->andWhere($qb->expr()->eq('i.ward', ':ward')) /* */
45
+        			->setParameter('ward', $wardId);
46 46
 		}
47 47
 		
48
-		$query = $qb->getQuery ();
49
-		$infections = $query->getResult ();
48
+		$query = $qb->getQuery();
49
+		$infections = $query->getResult();
50 50
 		
51 51
 		return $infections;
52 52
 	}
53 53
 	public static function updateVerification($id, $weryfikacja) {
54 54
 		if ($id != null && $weryfikacja != null) {
55
-			$em = ( object ) DoctrineBootstrap::getEntityManager ();
56
-			$infection = $em->getRepository ( 'Hospitalplugin\Entities\Infections' )->find ( $id );
57
-			$infection->setWeryfikacja ( $weryfikacja );
58
-			$em->flush ();
55
+			$em = (object) DoctrineBootstrap::getEntityManager();
56
+			$infection = $em->getRepository('Hospitalplugin\Entities\Infections')->find($id);
57
+			$infection->setWeryfikacja($weryfikacja);
58
+			$em->flush();
59 59
 		}
60 60
 	}
61 61
 	public static function obj2DB($obj) {
Please login to merge, or discard this patch.
src/Entities/InfectionsZMO.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
  *        @index(name="oddzialId_idx", columns={"oddzialId"}),
45 45
  *        @index(name="userId_idx", columns={"userId"})})
46 46
  */
47
-class InfectionsZMO extends InfectionRaport{
47
+class InfectionsZMO extends InfectionRaport {
48 48
 	
49 49
 	/**
50 50
 	 * @Column(columnDefinition="DECIMAL(4,0) NOT NULL DEFAULT 0") *
Please login to merge, or discard this patch.
src/Entities/Patient.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
 	 * @param unknown $args        	
114 114
 	 */
115 115
 	function __construct($args) {
116
-		if (! isset ( $args ) || empty ( $args )) {
116
+		if (!isset ($args) || empty ($args)) {
117 117
 			return;
118 118
 		}
119
-		foreach ( $args as $key => $value ) {
119
+		foreach ($args as $key => $value) {
120 120
 			if ($key == 'dataKategoryzacji') {
121
-				$value = new \DateTime ( $value . ' 12:00:00' );
121
+				$value = new \DateTime($value.' 12:00:00');
122 122
 			}
123
-			call_user_func ( array (
123
+			call_user_func(array(
124 124
 					$this,
125
-					'set' . $key 
126
-			), $value );
125
+					'set'.$key 
126
+			), $value);
127 127
 		}
128 128
 	}
129 129
 	
@@ -333,23 +333,23 @@  discard block
 block discarded – undo
333 333
 	 * @return string
334 334
 	 */
335 335
 	public function toString() {
336
-		$txt = $this->getName ();
337
-		$txt .= $this->getPesel ();
336
+		$txt = $this->getName();
337
+		$txt .= $this->getPesel();
338 338
 		$txt .= "id:";
339
-		$txt .= $this->getId ();
339
+		$txt .= $this->getId();
340 340
 		$txt .= "oid:";
341
-		$txt .= $this->getOddzialId ();
341
+		$txt .= $this->getOddzialId();
342 342
 		$txt .= "d:";
343
-		$data = $this->getDataKategoryzacji ();
343
+		$data = $this->getDataKategoryzacji();
344 344
 		if ($data instanceof \DateTime) {
345
-			$txt .= $this->getDataKategoryzacji ()->format ( "Y-m-d" );
345
+			$txt .= $this->getDataKategoryzacji()->format("Y-m-d");
346 346
 		} else {
347
-			$txt .= $this->getDataKategoryzacji ();
347
+			$txt .= $this->getDataKategoryzacji();
348 348
 		}
349 349
 		return $txt;
350 350
 	}
351 351
 	public function __toString() {
352
-		return $this->toString ();
352
+		return $this->toString();
353 353
 	}
354 354
 	
355 355
 	/**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 * @return multitype:string
359 359
 	 */
360 360
 	protected static function getFields() {
361
-		$fields = array (
361
+		$fields = array(
362 362
 				"id",
363 363
 				"name",
364 364
 				"pesel",
@@ -375,21 +375,21 @@  discard block
 block discarded – undo
375 375
 	 * @return string
376 376
 	 */
377 377
 	public function toDatatablesJSONString() {
378
-		$return_object_array = [ ];
379
-		$fields = $this->getFields ();
380
-		foreach ( $fields as $field ) {
381
-			$value = call_user_func ( array (
378
+		$return_object_array = [];
379
+		$fields = $this->getFields();
380
+		foreach ($fields as $field) {
381
+			$value = call_user_func(array(
382 382
 					$this,
383
-					'get' . $field 
384
-			) );
383
+					'get'.$field 
384
+			));
385 385
 			if ($value instanceof \DateTime) {
386
-				$value = $value->format ( 'Y-m-d' );
386
+				$value = $value->format('Y-m-d');
387 387
 			}
388
-			array_push ( $return_object_array, array (
388
+			array_push($return_object_array, array(
389 389
 					$field => $value 
390
-			) );
390
+			));
391 391
 		}
392
-		return json_encode ( $this );
392
+		return json_encode($this);
393 393
 	}
394 394
 	
395 395
 	/**
@@ -402,19 +402,19 @@  discard block
 block discarded – undo
402 402
 	 */
403 403
 	public function toDatatablesString() {
404 404
 		$string = "";
405
-		$fields = $this::getFields ();
406
-		foreach ( $fields as $field ) {
407
-			$value = call_user_func ( array (
405
+		$fields = $this::getFields();
406
+		foreach ($fields as $field) {
407
+			$value = call_user_func(array(
408 408
 					$this,
409
-					'get' . $field 
410
-			) );
409
+					'get'.$field 
410
+			));
411 411
 			if ($value instanceof \DateTime) {
412
-				$value = $value->format ( 'Y-m-d' );
412
+				$value = $value->format('Y-m-d');
413 413
 			}
414
-			$string .= $value . ",";
414
+			$string .= $value.",";
415 415
 		}
416
-		$string = trim ( $string, "," );
417
-		$string = str_replace ( "\n", "", $string );
416
+		$string = trim($string, ",");
417
+		$string = str_replace("\n", "", $string);
418 418
 		return $string;
419 419
 	}
420 420
 }
Please login to merge, or discard this patch.
src/Entities/PatientBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
             }
54 54
             call_user_func(array(
55 55
                 $patient,
56
-                'set' . ucwords($key)
56
+                'set'.ucwords($key)
57 57
             ), $value);
58 58
         }
59 59
         return $patient;
Please login to merge, or discard this patch.
src/Entities/PatientCRUD.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return Patient array
44 44
 	 */
45 45
 	public static function getPatients($month = null, $day = null, $wardId = 0) {
46
-		return PatientCRUD::getPatientsDateRange ( Utils::getStartDate ( $month, $day ), Utils::getEndDate ( $month, $day ), $wardId );
46
+		return PatientCRUD::getPatientsDateRange(Utils::getStartDate($month, $day), Utils::getEndDate($month, $day), $wardId);
47 47
 	}
48 48
 	
49 49
 	/**
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 	 * @return Patient array
60 60
 	 */
61 61
 	public static function getPatientsDateRange($date1, $date2, $wardId = 0) {
62
-		$entityManager = ( object ) DoctrineBootstrap::getEntityManager ();
63
-		$params = array (
62
+		$entityManager = (object) DoctrineBootstrap::getEntityManager();
63
+		$params = array(
64 64
 				'from' => $date1,
65 65
 				'to' => $date2,
66 66
 				'oddzialId' => $wardId 
67 67
 		);
68
-		$q = $entityManager->createQuery ( 'select p FROM Hospitalplugin\Entities\Patient p WHERE p.dataKategoryzacji BETWEEN :from AND :to and p.oddzialId = :oddzialId ORDER BY p.name' )->setParameters ( $params )->setFirstResult ( 0 )->setMaxResults ( 1000 );
69
-		$patients = $q->getResult ();
68
+		$q = $entityManager->createQuery('select p FROM Hospitalplugin\Entities\Patient p WHERE p.dataKategoryzacji BETWEEN :from AND :to and p.oddzialId = :oddzialId ORDER BY p.name')->setParameters($params)->setFirstResult(0)->setMaxResults(1000);
69
+		$patients = $q->getResult();
70 70
 		return $patients;
71 71
 	}
72 72
 	
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	 * @return Patient Patient
80 80
 	 */
81 81
 	public static function getPatient($id, $type = '') {
82
-		$entityManager = ( object ) DoctrineBootstrap::getEntityManager ();
83
-		$type = 'Hospitalplugin\Entities\Patient' . $type;
84
-		$patient = $entityManager->getRepository ( $type )->findOneBy ( array (
82
+		$entityManager = (object) DoctrineBootstrap::getEntityManager();
83
+		$type = 'Hospitalplugin\Entities\Patient'.$type;
84
+		$patient = $entityManager->getRepository($type)->findOneBy(array(
85 85
 				'id' => $id 
86
-		) );
87
-		return Utils::cast ( $type, ( object ) $patient, 0 );
86
+		));
87
+		return Utils::cast($type, (object) $patient, 0);
88 88
 	}
89 89
 	
90 90
 	/**
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 	 * @return Patient
96 96
 	 */
97 97
 	public static function setPatientCategories($obj, $type) {
98
-		$entityManager = DoctrineBootstrap::getEntityManager ();
99
-		$patient = PatientCRUD::getPatient ( $obj->id, $type );
100
-		foreach ( get_object_vars ( $obj ) as $key => $value ) {
101
-			call_user_func ( array (
98
+		$entityManager = DoctrineBootstrap::getEntityManager();
99
+		$patient = PatientCRUD::getPatient($obj->id, $type);
100
+		foreach (get_object_vars($obj) as $key => $value) {
101
+			call_user_func(array(
102 102
 					$patient,
103
-					'set' . ucwords ( $key ) 
104
-			), $value );
103
+					'set'.ucwords($key) 
104
+			), $value);
105 105
 		}
106
-		$entityManager->merge ( $patient );
107
-		$entityManager->flush ();
106
+		$entityManager->merge($patient);
107
+		$entityManager->flush();
108 108
 		return $patient;
109 109
 	}
110 110
 	
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 	 * @return Patient
117 117
 	 */
118 118
 	public static function createPatient($type, $name, $pesel) {
119
-		$entityManager = DoctrineBootstrap::getEntityManager ();
120
-		$type = 'Hospitalplugin\Entities\Patient' . $type;
121
-		$patient = new $type ();
122
-		$patient->setName ( $name );
123
-		$patient->setPesel ( $pesel );
124
-		$entityManager->persist ( $patient );
125
-		$entityManager->flush ();
119
+		$entityManager = DoctrineBootstrap::getEntityManager();
120
+		$type = 'Hospitalplugin\Entities\Patient'.$type;
121
+		$patient = new $type();
122
+		$patient->setName($name);
123
+		$patient->setPesel($pesel);
124
+		$entityManager->persist($patient);
125
+		$entityManager->flush();
126 126
 		return $patient;
127 127
 	}
128 128
 	
@@ -133,19 +133,19 @@  discard block
 block discarded – undo
133 133
 	 *        	int
134 134
 	 */
135 135
 	public static function deletePatient($id, $userId = 0) {
136
-		$entityManager = ( object ) DoctrineBootstrap::getEntityManager ();
136
+		$entityManager = (object) DoctrineBootstrap::getEntityManager();
137 137
 		$type = 'Hospitalplugin\Entities\Patient';
138
-		$patient = $entityManager->getRepository ( $type )->findOneBy ( array (
138
+		$patient = $entityManager->getRepository($type)->findOneBy(array(
139 139
 				'id' => $id 
140
-		) );
141
-		$entityManager->remove ( $patient );
140
+		));
141
+		$entityManager->remove($patient);
142 142
 		$log = strval($patient);
143 143
 		$audit = new PatientDeleted();
144
-		$audit->deletedAt = new \DateTime ();
144
+		$audit->deletedAt = new \DateTime();
145 145
 		$audit->deletedByUserId = $userId;
146 146
 		$audit->log = $log;
147
-		$entityManager->persist ( $audit );
148
-		$entityManager->flush ();
147
+		$entityManager->persist($audit);
148
+		$entityManager->flush();
149 149
 	}
150 150
 }
151 151
 ?>
152 152
\ No newline at end of file
Please login to merge, or discard this patch.