Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
9 | public function generate(Table $model) { |
||
10 | $filter = $this->codegenService->getWriteFilter($model); |
||
11 | if (count($filter) == 0) { |
||
12 | return null; |
||
13 | } |
||
14 | $class = new EmberClassGenerator('JSONAPISerializer'); |
||
15 | $class->addImport('JSONSerializer', 'ember-data/serializers/json'); |
||
16 | |||
17 | $attrs = ''; |
||
18 | foreach ($filter as $field) { |
||
19 | $attrs .= sprintf("\t%s: {serialize: false },\n", NameUtils::toCamelCase($field)); |
||
20 | } |
||
21 | $attrs = "{\n\t" . rtrim($attrs, "\n,") . "\n}"; |
||
22 | $class->setProperty('attrs', $attrs); |
||
23 | |||
24 | return $class->generate(); |
||
25 | } |
||
26 | } |