Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Introduction

The public API will give you an easy access to the eZ Publish content repository. This repository is the core component that manages content, locations (former Nodes), sections, content types (former Content Classes), user groups, users and roles. It also provides a new, clear interface for plugging in custom field types (former Datatypes).
 
The public API is built on top of a layered architecture including a new persistence layer for abstracting the storage functionality. By using the public API, your applications will be forward compatible with future releases based on enhanced,  scalable and high-performance storage engines. Applications based on the public API are also fully backwards compatible by using the included storage engine based on the current kernel and database model.


Receipt 1 - Setting up a sample commandline symfony bundle which uses the public API

This receipt shows how to setup a simple symfony bundle with a commandline script using the public API. The command is executable within the app/console and dumps a content object for a given content id.

Go to the eZ publish installation

cd <ezpublish installation root>

Generate a new Bundle

php app/console generate:bundle

Now follow the instructions. This will create a bundle eZ/Publish/Bundle/CookBookBundle in the src directory of the installation root.

 

 

 

 

 

 

Add a Command directory to the bundle

cd <ezpublish installation root>/eZ/Publish/Bundle/CookbookBundle

mkdir Command

add the following class file CookbookCommand.php in the directory Command

 

my first command

 

run f.e.

php app/console cookbook:run  57

 

Receipt 2  Creating a content type group

This snippet creates a content type group for a given identifier.

create content type group

If this snipped is run with the same init code from receipt 1 we will get an UnauthorizedException.

The solution is described in the next receipt.

Receipt 3 - Setting the user for authorizing actions

By default the repository assumes the anonymous user is acting. To change this the following code can be executed

authentication

If the user is identified by other mechanisms the user also can be loaded by its id via the service method

$userService->loadUser($id)

 

  • No labels