| Conditions | 4 |
| Paths | 6 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | protected function createField(Entity $target, Field $source, string $name) |
||
| 46 | { |
||
| 47 | $field = new Field(); |
||
| 48 | $field->setColumn($name); |
||
| 49 | $field->setTypecast($source->getTypecast()); |
||
| 50 | |||
| 51 | switch ($source->getType()) { |
||
| 52 | case 'primary': |
||
| 53 | $field->setType('int'); |
||
| 54 | break; |
||
| 55 | case 'bigPrimary': |
||
| 56 | $field->setType('bigint'); |
||
| 57 | break; |
||
| 58 | default: |
||
| 59 | $field->setType($source->getType()); |
||
| 60 | } |
||
| 61 | |||
| 62 | if ($this->getOptions()->get(Relation::NULLABLE)) { |
||
| 63 | $field->getOptions()->set(ColumnSchema::OPT_NULLABLE, true); |
||
| 64 | } |
||
| 65 | |||
| 66 | $target->getFields()->set($name, $field); |
||
| 67 | } |
||
| 73 | } |