| 536 | | $unset = array('name', 'type', 'length', 'alltypes', 'ntype'); |
| | 533 | |
| | 534 | // Remove name, alltypes, ntype. They are not needed in options array |
| | 535 | unset($options['name']); |
| | 536 | unset($options['alltypes']); |
| | 537 | unset($options['ntype']); |
| | 538 | |
| | 539 | // Remove notnull => true if the column is primary |
| | 540 | // Primary columns are implied to be notnull in Doctrine |
| | 541 | if (isset($options['primary']) && $options['primary'] == true && (isset($options['notnull']) && $options['notnull'] == true)) { |
| | 542 | unset($options['notnull']); |
| | 543 | } |
| | 544 | |
| | 545 | // Remove default if the value is 0 and the column is a primary key |
| | 546 | // Doctrine defaults to 0 if it is a primary key |
| | 547 | if (isset($options['primary']) && $options['primary'] == true && (isset($options['default']) && $options['default'] == 0)) { |
| | 548 | unset($options['default']); |
| | 549 | } |
| | 550 | |
| | 551 | // These can be removed if they are empty. They all default to a false/0/null value anyways |
| | 552 | $remove = array('fixed', 'primary', 'notnull', 'autoincrement', 'unsigned'); |
| | 553 | foreach ($remove as $key) { |
| | 554 | if (isset($options[$key]) && empty($options[$key])) { |
| | 555 | unset($options[$key]); |
| | 556 | } |
| | 557 | } |
| | 558 | |
| | 559 | // Remove null and empty array values |