1313
1414class RelationBusiness extends SuperBusiness implements IColumnTypeBusiness {
1515
16- public function __construct (LoggerInterface $ logger , private RelationService $ relationService ) {
17- parent ::__construct ($ logger );
18- }
16+ public function __construct (
17+ LoggerInterface $ logger ,
18+ private RelationService $ relationService ,
19+ ) {
20+ parent ::__construct ($ logger );
21+ }
1922
2023 /**
2124 * @param mixed $value (array|string|null)
@@ -28,18 +31,18 @@ public function parseValue($value, ?Column $column = null): string {
2831 return '' ;
2932 }
3033
31- $ relationData = $ this ->relationService ->getRelationData ($ column );
34+ $ relationData = $ this ->relationService ->getRelationData ($ column );
3235
33- if (is_array ($ value ) && isset ($ value ['context ' ]) && $ value ['context ' ] === 'import ' ) {
34- $ matchingRelation = array_filter ($ relationData , fn ($ relation ) => $ relation ['label ' ] === $ value ['value ' ]);
36+ if (is_array ($ value ) && isset ($ value ['context ' ]) && $ value ['context ' ] === 'import ' ) {
37+ $ matchingRelation = array_filter ($ relationData , fn ($ relation ) => $ relation ['label ' ] === $ value ['value ' ]);
3538 if (!empty ($ matchingRelation )) {
3639 return json_encode (reset ($ matchingRelation )['id ' ]);
3740 }
38- } else {
39- if (isset ($ relationData [$ value ])) {
40- return json_encode ($ relationData [$ value ]['id ' ]);
41- }
42- }
41+ } else {
42+ if (isset ($ relationData [$ value ])) {
43+ return json_encode ($ relationData [$ value ]['id ' ]);
44+ }
45+ }
4346
4447 return '' ;
4548 }
@@ -58,18 +61,18 @@ public function canBeParsed($value, ?Column $column = null): bool {
5861 return true ;
5962 }
6063
61- $ relationData = $ this ->relationService ->getRelationData ($ column );
64+ $ relationData = $ this ->relationService ->getRelationData ($ column );
6265
63- if (is_array ($ value ) && isset ($ value ['context ' ]) && $ value ['context ' ] === 'import ' ) {
64- $ matchingRelation = array_filter ($ relationData , fn ($ relation ) => $ relation ['label ' ] === $ value ['value ' ]);
66+ if (is_array ($ value ) && isset ($ value ['context ' ]) && $ value ['context ' ] === 'import ' ) {
67+ $ matchingRelation = array_filter ($ relationData , fn ($ relation ) => $ relation ['label ' ] === $ value ['value ' ]);
6568 if (!empty ($ matchingRelation )) {
6669 return true ;
6770 }
68- } else {
69- if (isset ($ relationData [$ value ])) {
70- return true ;
71- }
72- }
71+ } else {
72+ if (isset ($ relationData [$ value ])) {
73+ return true ;
74+ }
75+ }
7376
7477 return false ;
7578 }
0 commit comments