Bolt\Legacy\Storage::updateContent PHP Method

updateContent() private method

Update a Bolt contenttype record.
private updateContent ( Content $content, string $comment = null ) : boolean
$content Content The content object to be updated
$comment string Add a comment to save with change.
return boolean
    private function updateContent(Content $content, $comment = null)
    {
        $tablename = $this->getContenttypeTablename($content->contenttype);
        // Set the date the record was changed
        $content->setValue('datechanged', date('Y-m-d H:i:s'));
        // Test that the record exists in the database
        $oldContent = $this->findContent($tablename, $content['id']);
        if (empty($oldContent)) {
            throw new StorageException('Attempted to update a non-existent record');
        }
        // Get the JSON database prepared values and make sure it's valid
        $fieldvalues = $this->getValidSaveData($content->getValues(true), $content->contenttype);
        // Do the actual update, and log it.
        $res = $this->app['db']->update($tablename, $fieldvalues, ['id' => $content['id']]);
        if ($res > 0) {
            $this->logUpdate($content->contenttype['slug'], $content['id'], $fieldvalues, $oldContent, $comment);
            return true;
        }
    }