public function create(ImportedEventModel $importedEvent) { global $DB; $stat = $DB->prepare("INSERT INTO imported_event ( import_url_id, import_id, title, " . "description, start_at, end_at, timezone, is_deleted, url, ticket_url, created_at, reoccur ) " . " VALUES ( :import_url_id, :import_id, :title, " . ":description, :start_at, :end_at, :timezone, '0', :url, :ticket_url, :created_at, :reoccur ) RETURNING id"); $stat->execute(array('import_url_id' => $importedEvent->getImportUrlId(), 'import_id' => $importedEvent->getImportId(), 'title' => substr($importedEvent->getTitle(), 0, VARCHAR_COLUMN_LENGTH_USED), 'description' => $importedEvent->getDescription(), 'start_at' => $importedEvent->getStartAtInUTC()->format("Y-m-d H:i:s"), 'end_at' => $importedEvent->getEndAtInUTC()->format("Y-m-d H:i:s"), 'timezone' => $importedEvent->getTimezone(), 'url' => $importedEvent->getUrl(), 'ticket_url' => $importedEvent->getTicketUrl(), 'reoccur' => $importedEvent->getReoccur() ? json_encode($importedEvent->getReoccur()) : null, 'created_at' => \TimeSource::getFormattedForDataBase())); $data = $stat->fetch(); $importedEvent->setId($data['id']); }