Skip to content
This repository was archived by the owner on Dec 16, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/CrudKit/Data/SQL/SQLColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ abstract class SQLColumn {
const TYPE_NUMBER = "number";
const TYPE_DATETIME = "datetime";
const TYPE_DATE = "date";
const TYPE_BOOLEAN = "boolean";

public function __construct ($id, $category, $options) {
$this->id = $id;
Expand Down Expand Up @@ -101,6 +102,8 @@ public function prepareForClient ($value) {
$date = date_format($date,'m-d-Y');
return $date;
break;
case "boolean":
return "".(boolval($value) ? 'true' : 'false')."\n" ;
default:
throw new \Exception("Unknown type {$this->typeName}");
}
Expand Down Expand Up @@ -158,6 +161,8 @@ public static function simplifyTypeName ($typeName) {
return self::TYPE_DATETIME;
case "date":
return self::TYPE_DATE;
case "boolean":
return self::TYPE_STRING;
default:
throw new \Exception("Unknown type $typeName");
}
Expand Down