Creates a new version for the given $struct and $versionNo.

@param \eZ\Publish\SPI\Persistence\Content\CreateStruct $struct
@param mixed $versionNo

@return \eZ\Publish\SPI\Persistence\Content\VersionInfo
424911
public function createVersionInfoFromCreateStruct(CreateStruct $struct, $versionNo)
    {
        $versionInfo = new VersionInfo();

        $versionInfo->id = null;
        $versionInfo->contentInfo = $this->createContentInfoFromCreateStruct($struct, $versionNo);
        $versionInfo->versionNo = $versionNo;
        $versionInfo->creatorId = $struct->ownerId;
        $versionInfo->status = VersionInfo::STATUS_DRAFT;
        $versionInfo->initialLanguageCode = $this->languageHandler->load($struct->initialLanguageId)->languageCode;
        $versionInfo->creationDate = $struct->modified;
        $versionInfo->modificationDate = $struct->modified;
        $versionInfo->names = $struct->name;

        $languages = [];
        foreach ($struct->fields as $field) {
            if (!isset($languages[$field->languageCode])) {
                $languages[$field->languageCode] = true;
            }
        }
        $versionInfo->languageCodes = array_keys($languages);

        return $versionInfo;
    }
837317
public static function structToString($struct, array $options = [])
    {
        $header = StructureHelper::getValue($options, 'header');
        $asArray = StructureHelper::getValue($options, 'as_array');
        $strict = StructureHelper::getValue($options, 'strict');

        // Build the object variables string
        $vars = '';

        foreach ($struct as $k => $v) {
            if (is_scalar($v)) {
                $vars .= sprintf("    '%s' => '%s',\n", $k, addcslashes($v, '\\\''));
            } elseif (is_array($v) || is_object($v)) {
                $vars .= sprintf("    '%s' => %s,\n", $k, static::getArrayString((array) $v));
            }
        }

        if (!$asArray) {
            if ($strict) {
                $str = "<?php declare(strict_types=1);\n";
            } else {
                $str = "<?php\n";
            }

            if ($header) {
                $str .= $header . "\n";
            }

            $str .= "\nreturn [\n";
        } else {
            $str = "[\n";
        }

        $str .= $vars;
        $str .= ']';

        if (!$asArray) {
            $str .= ";\n";

            // Use the closing tag if set to true in parameters.
            if (StructureHelper::getValue($options, 'closingtag', false)) {
                $str .= "\n?>";
            }
        }

        return $str;
    }
823023
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerBrandVersionQuery::create()
            ->filterByDealerBrand($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
842212
@Override
    public Struct createStruct(String typeName, Object[] attributes) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
1295636
public function storeFileReference(VersionInfo $versionInfo, Field $field)
    {
        $referencedData = $this->getFileReferenceData($field->id, $versionInfo->versionNo);

        if ($referencedData === null) {
            $this->storeNewFieldData($versionInfo, $field);
        } elseif (is_array($referencedData) && !empty(array_diff_assoc($referencedData, $field->value->externalData))) {
            $this->updateFieldData($versionInfo, $field);
        }

        return false;
    }
1288785
public function create(CreateStruct $struct)
    {
        $language = $this->languageMapper->createLanguageFromCreateStruct(
            $struct
        );
        $language->id = $this->languageGateway->insertLanguage($language);

        return $language;
    }
165327
public function publishVersion($contentId, $versionNumber)
    {
        if (!$this->isUserContent($contentId)) {
            parent::publishVersion($contentId, $versionNumber);
        }

        return new NoContent();
    }
956468
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerContactInfoVersionQuery::create()
            ->filterByDealerContactInfo($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
650530
private function buildImageId(VersionInfo $versionInfo, Field $field)
    {
        return sprintf(
            '%s-%s-%s',
            $versionInfo->contentInfo->id, $field->id, $versionInfo->versionNo
        );
    }
1064084
public function addSynonym(SynonymCreateStruct $createStruct)
    {
        $mainTagData = $this->gateway->getBasicTagData($createStruct->mainTagId);
        $newSynonymId = $this->gateway->createSynonym($createStruct, $mainTagData);

        return $this->load($newSynonymId);
    }
495370
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerVersionQuery::create()
            ->filterByDealer($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
693200
public function updateGroup(GroupUpdateStruct $struct)
    {
        $this->contentTypeGateway->updateGroup(
            $struct
        );

        return $this->loadGroup($struct->id);
    }
218019
public static function structToString($struct, array $options = [])
    {
        $tb = new TomlBuilder();

        if ($struct instanceof \Traversable) {
            $struct = iterator_to_array($struct);
        } elseif (is_object($struct)) {
            $struct = get_object_vars($struct);
        } else {
            $struct = (array) $struct;
        }

        static::addValues($tb, $struct);

        return $tb->getTomlString();
    }
1077064
public function addStruct($structName, $isStruct = true, $structType = '')
    {
        if (null === (empty($structType) ? $this->get($structName) : $this->getByType($structName, $structType))) {
            $model = new Model($this->generator, $structName, $isStruct);
            $this->add($model->setInheritance($structType));
        }
        return $this;
    }
221456
public function mapObjectToCreateStruct(ContentCreateStruct $createStruct)
    {
        // Name collection (ez => transfer)
        $keys = array(
            'mainLanguageCode' => 'main_language_code',
            'remoteId' => 'remote_id',
        );

        $this->arrayToStruct($createStruct, $keys);

        $this->assignStructFieldValues($createStruct);

        $this->callStruct($createStruct);
    }
1207089
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerContentVersionQuery::create()
            ->filterByDealerContent($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
894649
public function createRelationFromCreateStruct(RelationCreateStruct $struct)
    {
        $relation = new Relation();

        $relation->destinationContentId = $struct->destinationContentId;
        $relation->sourceContentId = $struct->sourceContentId;
        $relation->sourceContentVersionNo = $struct->sourceContentVersionNo;
        $relation->sourceFieldDefinitionId = $struct->sourceFieldDefinitionId;
        $relation->type = $struct->type;

        return $relation;
    }