Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mevdschee/php-crud-api
Browse files Browse the repository at this point in the history
  • Loading branch information
mevdschee committed Mar 5, 2017
2 parents c060399 + e550cb8 commit 40be702
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions api.php
Expand Up @@ -471,7 +471,7 @@ public function isGeometryType($field) {
}

public function isJsonType($field) {
return $field->type == 'jsonb';
return in_array($field->type,array('json','jsonb'));
}

public function getDefaultCharset() {
Expand Down Expand Up @@ -1059,11 +1059,11 @@ public function isBinaryType($field) {
}

public function isGeometryType($field) {
return in_array($field->type,array('geometry'));;
return in_array($field->type,array('geometry'));
}

public function isJsonType($field) {
return in_array($field->type,array('json','jsonb'));;
return in_array($field->type,array('json','jsonb'));
}

public function getDefaultCharset() {
Expand Down Expand Up @@ -2249,7 +2249,6 @@ protected function swagger($settings) {
$table_fields[$table['name']][$row[0]]->required = strtolower($row[2])=='no' && $row[1]===null;
$table_fields[$table['name']][$row[0]]->{'x-nullable'} = strtolower($row[2])=='yes';
$table_fields[$table['name']][$row[0]]->{'x-dbtype'} = $row[3];
$table_fields[$table['name']][$row[0]]->maxLength = $row[4];
if ($this->db->isNumericType($table_fields[$table['name']][$row[0]])) {
if (strpos(strtolower($table_fields[$table['name']][$row[0]]->{'x-dbtype'}),'int')!==false) {
$table_fields[$table['name']][$row[0]]->type = 'integer';
Expand All @@ -2258,7 +2257,6 @@ protected function swagger($settings) {
$table_fields[$table['name']][$row[0]]->type = 'number';
if ($row[1]!==null) $table_fields[$table['name']][$row[0]]->default = (float)$row[1];
}

} else {
if ($this->db->isBinaryType($table_fields[$table['name']][$row[0]])) {
$table_fields[$table['name']][$row[0]]->format = 'byte';
Expand All @@ -2269,6 +2267,7 @@ protected function swagger($settings) {
}
$table_fields[$table['name']][$row[0]]->type = 'string';
if ($row[1]!==null) $table_fields[$table['name']][$row[0]]->default = $row[1];
if ($row[4]!==null) $table_fields[$table['name']][$row[0]]->maxLength = (int)$row[4];
}
}

Expand Down

0 comments on commit 40be702

Please sign in to comment.