eZPublishCommunityProject  2013.5
eZ\Publish\Core\Repository\TrashService Class Reference
+ Inheritance diagram for eZ\Publish\Core\Repository\TrashService:
+ Collaboration diagram for eZ\Publish\Core\Repository\TrashService:

Public Member Functions

 __construct (RepositoryInterface $repository, Handler $handler, array $settings=array())
 Setups service with reference to repository object that created it & corresponding handler. More...
 
 deleteTrashItem (APITrashItem $trashItem)
 Deletes a trash item. More...
 
 emptyTrash ()
 Empties trash. More...
 
 findTrashItems (Query $query)
 Returns a collection of Trashed locations contained in the trash. More...
 
 loadTrashItem ($trashItemId)
 Loads a trashed location object from its $id. More...
 
 recover (APITrashItem $trashItem, Location $newParentLocation=null)
 Recovers the $trashedLocation at its original place if possible. More...
 
 trash (Location $location)
 Sends $location and all its children to trash and returns the corresponding trash item. More...
 
- Public Member Functions inherited from eZ\Publish\API\Repository\TrashService
 deleteTrashItem (TrashItem $trashItem)
 Deletes a trash item. More...
 
 recover (TrashItem $trashItem, Location $newParentLocation=null)
 Recovers the $trashedLocation at its original place if possible. More...
 

Protected Member Functions

 buildDomainTrashItemObject (Trashed $spiTrashItem)
 Builds the domain TrashItem object from provided persistence trash item. More...
 
 getDateTime ($timestamp)
 

Protected Attributes

 $persistenceHandler
 
 $repository
 
 $settings
 

Constructor & Destructor Documentation

eZ\Publish\Core\Repository\TrashService::__construct ( RepositoryInterface  $repository,
Handler  $handler,
array  $settings = array() 
)

Setups service with reference to repository object that created it & corresponding handler.

Parameters
\eZ\Publish\API\Repository\Repository$repository
\eZ\Publish\SPI\Persistence\Handler$handler
array$settings

Member Function Documentation

eZ\Publish\Core\Repository\TrashService::buildDomainTrashItemObject ( Trashed  $spiTrashItem)
protected

Builds the domain TrashItem object from provided persistence trash item.

Parameters
\eZ\Publish\SPI\Persistence\Content\Location\Trashed$spiTrashItem
Returns

Referenced by eZ\Publish\Core\Repository\TrashService\findTrashItems(), eZ\Publish\Core\Repository\TrashService\loadTrashItem(), and eZ\Publish\Core\Repository\TrashService\trash().

eZ\Publish\Core\Repository\TrashService::deleteTrashItem ( APITrashItem  $trashItem)

Deletes a trash item.

The corresponding content object will be removed

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to delete this trash item
Parameters
\eZ\Publish\API\Repository\Values\Content\TrashItem$trashItem
eZ\Publish\Core\Repository\TrashService::emptyTrash ( )

Empties trash.

All locations contained in the trash will be removed. Content objects will be removed if all locations of the content are gone.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to empty the trash

Implements eZ\Publish\API\Repository\TrashService.

eZ\Publish\Core\Repository\TrashService::findTrashItems ( Query  $query)

Returns a collection of Trashed locations contained in the trash.

$query allows to filter/sort the elements to be contained in the collection.

Parameters
\eZ\Publish\API\Repository\Values\Content\Query$query
Returns

Implements eZ\Publish\API\Repository\TrashService.

eZ\Publish\Core\Repository\TrashService::getDateTime (   $timestamp)
protected
Parameters
int$timestamp
Returns
eZ\Publish\Core\Repository\TrashService::loadTrashItem (   $trashItemId)

Loads a trashed location object from its $id.

Note that $id is identical to original location, which has been previously trashed

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to read the trashed location
\eZ\Publish\API\Repository\Exceptions\NotFoundException- if the location with the given id does not exist
Parameters
int$trashItemId
Returns

Implements eZ\Publish\API\Repository\TrashService.

eZ\Publish\Core\Repository\TrashService::recover ( APITrashItem  $trashItem,
Location  $newParentLocation = null 
)

Recovers the $trashedLocation at its original place if possible.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to recover the trash item at the parent location location

If $newParentLocation is provided, $trashedLocation will be restored under it.

Parameters
\eZ\Publish\API\Repository\Values\Content\TrashItem$trashItem
\eZ\Publish\API\Repository\Values\Content\Location$newParentLocation
Returns
the newly created or recovered location
eZ\Publish\Core\Repository\TrashService::trash ( Location  $location)

Sends $location and all its children to trash and returns the corresponding trash item.

Content is left untouched.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to trash the given location
Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
Returns
null| null if location was deleted, otherwise TrashItem

Implements eZ\Publish\API\Repository\TrashService.

Member Data Documentation

eZ\Publish\Core\Repository\TrashService::$persistenceHandler
protected
eZ\Publish\Core\Repository\TrashService::$repository
protected
eZ\Publish\Core\Repository\TrashService::$settings
protected

The documentation for this class was generated from the following file: