Created
September 5, 2012 10:12
-
-
Save gggeek/3634494 to your computer and use it in GitHub Desktop.
eZP 5 content object+node creation exampe - the barebones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Nb: we assume that scripts are run from root dir, same as eZP4 | |
/** | |
* @var \eZ\Publish\API\Container $SC | |
*/ | |
$SC = require('bootstrap.php'); | |
// Log in as Admin | |
$repo = $SC->getRepository(); | |
$adminUser = $repo->getUserService()->loadUser( 14 ); | |
$repo->setCurrentUser( $adminUser ); | |
// Create a content | |
$CTService = $repo->getContentTypeService(); | |
$CType = $CTService->loadContentTypeByIdentifier( "testClass" ); | |
$CService = $repo->getContentService(); | |
$CStruct = $CService->newContentCreateStruct( $CType, "eng-GB" ); | |
$CStruct->setField( "title", "Hello world" ); | |
$LService = $repo->getLocationService(); | |
$LStruct = $LService->newLocationCreateStruct( 2 ); | |
$content = $CService->createContent( $CStruct, array( $LStruct ) ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment