Skip to content

Commit aca9d24

Browse files
committed
cambio para que una relación OneToOne sea objeto
1 parent f80ab4e commit aca9d24

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

ParseTypeScript/Parser.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,19 @@ private function getRelationCollectionProperty(string $type): string
225225
$matches = [];
226226

227227
$regex = array(
228-
'/targetEntity="([a-zA-Z]+)"/i' => '',
229-
'/targetEntity="([a-zA-Z]+)\\\\([a-zA-Z]+)\\\\([a-zA-Z]+)"/i' => '',
230-
'/targetEntity="([a-zA-Z]+)"/i' => '[]',
228+
'/targetEntity="([a-zA-Z]+)"/i',
229+
'/targetEntity="([a-zA-Z]+)\\\\([a-zA-Z]+)\\\\([a-zA-Z]+)"/i',
231230
);
232231

233-
foreach ($regex as $reg => $val) {
232+
foreach ($regex as $reg) {
234233
if (preg_match($reg, $type, $matches)) {
235-
$result = end($matches) . $val;
234+
235+
$collection = '[]';
236+
if (strpos($type, 'OneToOne') !== false) {
237+
$collection = '';
238+
}
239+
240+
$result = end($matches) . $collection;
236241
break;
237242
}
238243
}

0 commit comments

Comments
 (0)