/** * @param LiteObject[] $objects * @param array $keyFields * @param array $excludeFields * @return bool */ public function upsertAll(array $objects, array $keyFields, array $excludeFields = []) { if (!$objects) { return true; } if ($excludeFields) { $this->addIgnoreFields($excludeFields); } $fields = array_diff($objects[0]->getPropertyNames(), $this->getIgnoreFields()); $data = $this->objectsToData($objects); return $this->connector->upsert()->into($this->tableName, $fields)->valuesBulk($data)->setDuplicateKeys($keyFields)->executeDml(true); }
/** * @param string $key * @param string $value * @return bool */ public function set($key, $value) { return $this->connector->upsert()->into($this->tableName)->values(['ID' => $key, 'Data' => $value])->executeDml(); }