Insert a new contenttype record in the database.

@param \Bolt\Legacy\Content $content Record content to insert
@param string               $comment Editor's comment

@return boolean
491474
protected function insertContent(Content $content, $comment = null)
    {
        $tablename = $this->getContenttypeTablename($content->contenttype);

        // Set creation and update dates
        $content->setValue('datecreated', date('Y-m-d H:i:s'));
        $content->setValue('datechanged', date('Y-m-d H:i:s'));

        // id is set to autoincrement, so let the DB handle it
        unset($content->values['id']);

        // Get the JSON database prepared values and make sure it's valid
        $fieldvalues = $this->getValidSaveData($content->getValues(true), $content->contenttype);

        $this->app['db']->insert($tablename, $fieldvalues);

        $seq = null;
        if ($this->app['db']->getDatabasePlatform() instanceof PostgreSqlPlatform) {
            $seq = $tablename . '_id_seq';
        }

        $id = $this->app['db']->lastInsertId($seq);

        if ($id > 0) {
            $content->setValue('id', $id);
            $this->logInsert($content->contenttype['slug'], $id, $fieldvalues, $comment);

            return true;
        }
    }
942447
public static function create($content = null, $contentType = 'text/plain')
    {
        $instance = new static();

        $instance->content = $content;
        $instance->contentType = $contentType;

        return $instance;
    }
1349738
public function addObject( $contentObject, $commit = true )
    {
        $contentObjectID = $contentObject->attribute( 'id' );
        $currentVersion = $contentObject->currentVersion();

        if ( !$currentVersion )
        {
            $errCurrentVersion = $contentObject->attribute( 'current_version');
            eZDebug::writeError( "Failed to fetch \"current version\" ({$errCurrentVersion})" .
                                 " of content object (ID: {$contentObjectID})", 'eZSearchEngine' );
            return false;
        }

        $indexArray = array();
        $indexArrayOnlyWords = array();

        $wordCount = 0;
        $placement = 0;
        $previousWord = '';

        eZContentObject::recursionProtectionStart();
        foreach ( $currentVersion->contentObjectAttributes() as $attribute )
        {
            $metaData = array();
            $classAttribute = $attribute->contentClassAttribute();
            if ( $classAttribute->attribute( "is_searchable" ) == 1 )
            {
                // Fetch attribute translations
                $attributeTranslations = $attribute->fetchAttributeTranslations();

                foreach ( $attributeTranslations as $translation )
                {
                    $tmpMetaData = $translation->metaData();
                    if( ! is_array( $tmpMetaData ) )
                    {
                        $tmpMetaData = array( array( 'id' => $attribute->attribute( 'contentclass_attribute_identifier' ),
                                                     'text' => $tmpMetaData ) );
                    }
                    $metaData = array_merge( $metaData, $tmpMetaData );
                }

                foreach( $metaData as $metaDataPart )
                {
                    $text = eZSearchEngine::normalizeText( htmlspecialchars ($metaDataPart['text'], ENT_NOQUOTES, 'UTF-8' ) , true );

                    // Split text on whitespace
                    if ( is_numeric( trim( $text ) ) )
                    {
                        $integerValue = (int) $text;
                    }
                    else
                    {
                        $integerValue = 0;
                    }
                    $wordArray = explode( ' ', $text );

                    foreach ( $wordArray as $word )
                    {
                        if ( trim( $word ) != "" )
                        {
                            // words stored in search index are limited to 150 characters
                            if ( strlen( $word ) > 150 )
                            {
                                $word = substr( $word, 0, 150 );
                            }
                            $indexArray[] = array( 'Word' => $word,
                                                   'ContentClassAttributeID' => $attribute->attribute( 'contentclassattribute_id' ),
                                                   'identifier' => $metaDataPart['id'],
                                                   'integer_value' => $integerValue );
                            $indexArrayOnlyWords[$word] = 1;
                            $wordCount++;
                            //if we have "www." before word than
                            //treat it as url and add additional entry to the index
                            if ( substr( strtolower($word), 0, 4 ) == 'www.' )
                            {
                                $additionalUrlWord = substr( $word, 4 );
                                $indexArray[] = array( 'Word' => $additionalUrlWord,
                                                       'ContentClassAttributeID' => $attribute->attribute( 'contentclassattribute_id' ),
                                                       'identifier' => $metaDataPart['id'],
                                                       'integer_value' => $integerValue );
                                $indexArrayOnlyWords[$additionalUrlWord] = 1;
                                $wordCount++;
                            }
                        }
                    }
                }
            }
        }
        eZContentObject::recursionProtectionEnd();

        $wordIDArray = $this->buildWordIDArray( array_keys( $indexArrayOnlyWords ) );

        $db = eZDB::instance();
        $db->begin();
        for( $arrayCount = 0; $arrayCount < $wordCount; $arrayCount += 1000 )
        {
            $placement = $this->indexWords( $contentObject, array_slice( $indexArray, $arrayCount, 1000 ), $wordIDArray, $placement );
        }
        $db->commit();

        return true;
    }
788390
public function setSubscriptionComment($comment)
    {
        if (strlen($comment) > 200) {
            throw new InvalidArgumentException("Subscription comment cannot be longer than 200 characters");
        }
        if (preg_match('/[^a-zA-Z0-9_ -]/', $comment)) {
            throw new InvalidArgumentException("Subscription comment cannot contain special characters");
        }
        $this->parameters['sub_comment'] = $comment;
    }
533817
public function createComment(string $type, int $typeId, string $comment)
    {
        $type = strtolower($type);

        if (('project' !== $type && 'task' !== $type) || '' === $comment || ! $this->validateId($typeId)) {
            return false;
        }

        $data   = $this->prepareRequestData([
                                                $type . '_id' => $typeId,
                                                'content'     => $comment,
                                            ]);
        $result = $this->post('comments', $data);

        if (200 === $result->getStatusCode()) {
            return json_decode($result->getBody()->getContents());
        }

        return false;
    }
769305
public function setComment($comment)
    {
        if ($this->_comment != $comment) {
            $this->_comment = $comment;
            if ($this->_table) {
                $this->_setComment($comment);
            }
        }
    }
121636
public function setComment($comment)
    {
        if ( ! is_string($comment))
        {
            throw new InvalidArgumentException(
                'Expected a string, but got '.gettype($comment)
            );
        }

        $this->comment = $comment;
    }
261720
public function updateOrFail(Comment $comment)
    {
        $status = $this->update($comment);

        if (is_wp_error($status)) {
            throw new QueryException("Posttype [{$this->slug}] could not update post with id: {$id}.");
        }

        return $status;
    }
716626
public function addComment(NodeInterface $commentableNode, CommentDtoInterface $comment)
    {
        if (!$this->isCommentableNode($commentableNode)) {
            throw new InvalidNodeTypeException('The commentable node type should implement the mixin '.self::COMMENTABLE_NODE_TYPE, 1536244558);
        }

        $this->createNode($commentableNode->getNode('comments'), $comment);
    }
181093
private function updateFromPostCache(Comment $comment, $c)
    {
        if ($comment->postId == null)
        {
            return;
        }
        if ($this->postCache == null || $this->postCache['ID'] != $comment->postId)
        {
            $this->postCache = $this->adminApi->getPost($comment->postId);
        }

        $comment->date = $this->getMetaKeyValue($this->postCache, "linkoscope_created_$comment->id") ?: $c['date'];
        $comment->score =
            $this->getMetaKeyValue($this->postCache, "linkoscope_score_$comment->id") ?: strtotime($c['date']);
    }
400608
public function saved(ContentInterface $content)
    {
        if ($content->content_type_id !== null) {
            if (! $content->relationLoaded('type')) {
                $content->load('type');
            }

            $contentType = $content->getRelation('type');

            if ($contentType && $contentType->shouldDynamicTableExist() && ! $contentType->dynamicTableExists()) {
                $contentType->createTable();
            }
        }
    }
873786
public function checkIn($comment)
    {
        $qry = new InvokePostMethodQuery($this->getResourcePath(), "checkIn", array(
            "comment" => $comment,
            "checkintype" => 0
        ));
        $this->getContext()->addQuery($qry);
    }
1236139
public function addCommentOnColumn($table, $column, $comment)
    {
        $table = $this->db->quoteTableName($table);
        $column = $this->db->quoteColumnName($column);
        $comment = $this->db->quoteValue($comment);

        $this->execute("COMMENT ON COLUMN $table.$column IS $comment;");
    }
329316
public function addComment(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Comment\Comment $comment)
    {
        $this->comments[] = $comment;

        return $this;
    }
922692
public function insertExistingField(Content $content, Field $field, StorageFieldValue $value)
    {
        $q = $this->dbHandler->createInsertQuery();

        $this->setInsertFieldValues($q, $content, $field, $value);

        $q->set(
            $this->dbHandler->quoteColumn('id'),
            $q->bindValue($field->id, null, \PDO::PARAM_INT)
        );

        $q->prepare()->execute();
    }
282478
public function addComment(string $comment) : bool
    {
        if (is_string($comment)) {
            $this->comments[] = $comment;
        }

        return true;
    }
334512
public function addComment(Comment $comment)
    {
        if (!$this->comments->contains($comment)) {
            $this->comments->add($comment);
        }
    }