Conditions | 5 |
Paths | 7 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function compute(Registry $registry, Entity $entity) |
||
29 | { |
||
30 | if (!$registry->hasTable($entity)) { |
||
31 | // do not render entities without associated table |
||
32 | return; |
||
33 | } |
||
34 | |||
35 | $table = $registry->getTableSchema($entity); |
||
36 | |||
37 | $primaryKeys = []; |
||
38 | foreach ($entity->getFields() as $field) { |
||
39 | $column = ColumnSchema::parse($field); |
||
40 | |||
41 | if ($column->isPrimary()) { |
||
42 | $primaryKeys[] = $field->getColumn(); |
||
43 | } |
||
44 | |||
45 | $column->render($table->column($field->getColumn())); |
||
46 | } |
||
47 | |||
48 | if (count($primaryKeys)) { |
||
49 | $table->setPrimaryKeys($primaryKeys); |
||
50 | } |
||
52 | } |