config = $configFileReader->getDatabaseConfig(); } public function upload(Event $event) { // First insert the `node` record $this->executeQuery( 'INSERT INTO `node` (`vid`, `type`, `uuid`, `langcode`) VALUES (?, ?, ?, ?)', ['i', 's', 's', 's'], [0, 'private_event', $this->guidv4(), 'en'] ); $nodeID = $this->getLastInsertedID(); // Now add a `node_revision` record $this->executeQuery( 'INSERT INTO `node_revision` (`nid`, `langcode`, `revision_timestamp`, `revision_uid`) VALUES (?, ?, ?, ?)', ['i', 's', 'i', 'i'], [$nodeID, 'en', time(), 1] ); $revisionID = $this->getLastInsertedID(); // Update the original node record with the vid $this->executeQuery( 'UPDATE `node` SET `vid` = ? WHERE `nid` = ?', ['i', 'i'], [$revisionID, $nodeID] ); // Now add a `node_field_data` record $this->executeQuery( 'INSERT INTO `node_field_data` (`nid`, `vid`, `type`, `langcode`, `title`, `uid`, `status`, `created`, `changed`, `promote`, `sticky`, `revision_translation_affected`, `default_langcode`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', ['i', 'i', 's', 's', 's', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'i'], [$nodeID, $revisionID, 'private_event', 'en', $event->getTitle(), 1, 1, time(), time(), 0, 0, 1, 1] ); exit(); } private function guidv4() { if (function_exists('com_create_guid') === true) return trim(com_create_guid(), '{}'); $data = openssl_random_pseudo_bytes(16); $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); } }