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;
        }
    }
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;
        }
    }
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 ; } }
Update a Bolt contenttype record.

@param \Bolt\Legacy\Content $content The content object to be updated
@param string               $comment Add a comment to save with change.

@throws \Bolt\Exception\StorageException

@return bool
Update a Bolt contenttype record .