Skip to content

Commit

Permalink
Fix undefined index notice for model indexes
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/pr/76' into 2.x

* origin/pr/76:
  Fix undefined index notice for model indexes
  • Loading branch information
opengeek committed Jan 29, 2016
2 parents b5b91f6 + 1ca8ed6 commit f2340a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions xpdo/changelog.txt
Expand Up @@ -2,6 +2,7 @@ This file shows the changes in this release of xPDO.

xPDO 2.5.0-pl (TBD)
====================================
- Fix undefined index notice for model indexes
- Allow definition of primary key fields without legacy index="pk"
- Add ARRAY_EXTENDED logTarget that stores an array of data for each log entry

Expand Down
8 changes: 6 additions & 2 deletions xpdo/om/mysql/xpdomanager.class.php
Expand Up @@ -457,9 +457,13 @@ protected function getColumnDef($class, $name, $meta, array $options = array())
protected function getIndexDef($class, $name, $meta, array $options = array()) {
$result = '';
if (isset($meta['type']) && $meta['type'] == 'FULLTEXT') {
$indexType = "FULLTEXT";
$indexType = 'FULLTEXT';
} else if ( ! empty($meta['primary'])) {
$indexType = 'PRIMARY KEY';
} else if ( ! empty($meta['unique'])) {
$indexType = 'UNIQUE KEY';
} else {
$indexType = ($meta['primary'] ? 'PRIMARY KEY' : ($meta['unique'] ? 'UNIQUE KEY' : 'INDEX'));
$indexType = 'INDEX';
}
$index = $meta['columns'];
if (is_array($index)) {
Expand Down

0 comments on commit f2340a1

Please sign in to comment.