protected function internalCreate(CreateStruct $struct, $versionNo = 1)
    {
        $content = new Content();

        $content->fields = $struct->fields;
        $content->versionInfo = $this->mapper->createVersionInfoFromCreateStruct($struct, $versionNo);

        $content->versionInfo->contentInfo->id = $this->contentGateway->insertContentObject($struct, $versionNo);
        $content->versionInfo->id = $this->contentGateway->insertVersion(
            $content->versionInfo,
            $struct->fields
        );

        $contentType = $this->contentTypeHandler->load($struct->typeId);
        $this->fieldHandler->createNewFields($content, $contentType);

        // Create node assignments
        foreach ($struct->locations as $location) {
            $location->contentId = $content->versionInfo->contentInfo->id;
            $location->contentVersion = $content->versionInfo->versionNo;
            $this->locationGateway->createNodeAssignment(
                $location,
                $location->parentId,
                LocationGateway::NODE_ASSIGNMENT_OP_CODE_CREATE
            );
        }

        // Create names
        foreach ($content->versionInfo->names as $language => $name) {
            $this->contentGateway->setName(
                $content->versionInfo->contentInfo->id,
                $content->versionInfo->versionNo,
                $name,
                $language
            );
        }

        return $content;
    }
protected function internalCreate(CreateStruct $struct, $versionNo = 1)
    {
        $content = new Content();

        $content->fields = $struct->fields;
        $content->versionInfo = $this->mapper->createVersionInfoFromCreateStruct($struct, $versionNo);

        $content->versionInfo->contentInfo->id = $this->contentGateway->insertContentObject($struct, $versionNo);
        $content->versionInfo->id = $this->contentGateway->insertVersion(
            $content->versionInfo,
            $struct->fields
        );

        $contentType = $this->contentTypeHandler->load($struct->typeId);
        $this->fieldHandler->createNewFields($content, $contentType);

        // Create node assignments
        foreach ($struct->locations as $location) {
            $location->contentId = $content->versionInfo->contentInfo->id;
            $location->contentVersion = $content->versionInfo->versionNo;
            $this->locationGateway->createNodeAssignment(
                $location,
                $location->parentId,
                LocationGateway::NODE_ASSIGNMENT_OP_CODE_CREATE
            );
        }

        // Create names
        foreach ($content->versionInfo->names as $language => $name) {
            $this->contentGateway->setName(
                $content->versionInfo->contentInfo->id,
                $content->versionInfo->versionNo,
                $name,
                $language
            );
        }

        return $content;
    }
protected function internalCreate ( CreateStruct $ struct , $ versionNo = 1 ) { $ content = new Content ( ) ; $ content -> fields = $ struct -> fields ; $ content -> versionInfo = $ this -> mapper -> createVersionInfoFromCreateStruct ( $ struct , $ versionNo ) ; $ content -> versionInfo -> contentInfo -> id = $ this -> contentGateway -> insertContentObject ( $ struct , $ versionNo ) ; $ content -> versionInfo -> id = $ this -> contentGateway -> insertVersion ( $ content -> versionInfo , $ struct -> fields ) ; $ contentType = $ this -> contentTypeHandler -> load ( $ struct -> typeId ) ; $ this -> fieldHandler -> createNewFields ( $ content , $ contentType ) ; // Create node assignments foreach ( $ struct -> locations as $ location ) { $ location -> contentId = $ content -> versionInfo -> contentInfo -> id ; $ location -> contentVersion = $ content -> versionInfo -> versionNo ; $ this -> locationGateway -> createNodeAssignment ( $ location , $ location -> parentId , LocationGateway :: NODE_ASSIGNMENT_OP_CODE_CREATE ) ; } // Create names foreach ( $ content -> versionInfo -> names as $ language => $ name ) { $ this -> contentGateway -> setName ( $ content -> versionInfo -> contentInfo -> id , $ content -> versionInfo -> versionNo , $ name , $ language ) ; } return $ content ; }
Creates a new Content entity in the storage engine.

The values contained inside the $content will form the basis of stored
entity.

Will contain always a complete list of fields.

@param \eZ\Publish\SPI\Persistence\Content\CreateStruct $struct Content creation struct.
@param mixed $versionNo Used by self::copy() to maintain version numbers

@return \eZ\Publish\SPI\Persistence\Content Content value object
Creates a new Content entity in the storage engine .