File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
templates/cli/lib/type-generation/languages Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,20 @@ class <%- toPascalCase(collection.name) %> {
44
44
< % for (const attribute of collection . attributes ){ -% >
45
45
public < %- getType (attribute ) % > $< %- toCamelCase(attribute . key ) % > ;
46
46
< % } -% >
47
+
48
+ public function __construct (
49
+ <% for (const attribute of collection.attributes ){ -% >
50
+ < % if (attribute . required ) { -% >
51
+ < %- getType (attribute ). replace(' |null' , ' ' ) % > $< %- toCamelCase(attribute . key ) % >< % if (collection . attributes . indexOf(attribute ) < collection . attributes . length - 1 ) { % > ,< % } % >
52
+ < % } else { -% >
53
+ ?< %- getType (attribute ). replace(' |null' , ' ' ) % > $< %- toCamelCase(attribute . key ) % > = null < % if (collection . attributes . indexOf(attribute ) < collection . attributes . length - 1 ) { % > ,< % } % >
54
+ < % } -% >
55
+ < % } -% >
56
+ ) {
57
+ < % for (const attribute of collection . attributes ){ -% >
58
+ $this -> < %- toCamelCase(attribute . key ) % > = $< %- toCamelCase(attribute . key ) % > ;
59
+ < % } -% >
60
+ }
47
61
}` ;
48
62
}
49
63
You can’t perform that action at this time.
0 commit comments