Copied!

TrashService

TrashService.php : 21

Trash service, used for managing trashed content.

Methods

publicdeleteTrashItem()

TrashService.php : 88

Deletes a trash item.

public deleteTrashItem(TrashItem $trashItem) : TrashItemDeleteResult

The corresponding content object will be removed

Parameters

Name Type Default value Description
$trashItem TrashItem - -

Return values

TrashItemDeleteResult

Tags
Throws
UnauthorizedException

if the user is not allowed to delete this trash item

publicemptyTrash()

TrashService.php : 75

Empties trash.

public emptyTrash() : TrashItemDeleteResultList

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

Return values

TrashItemDeleteResultList

Tags
Throws
UnauthorizedException

if the user is not allowed to empty the trash

publicfindTrashItems()

TrashService.php : 99

Returns a collection of Trashed locations contained in the trash, which are readable by the current user.

public findTrashItems(Query $query) : SearchResult

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

Parameters

Name Type Default value Description
$query Query - -

Return values

SearchResult

publicloadTrashItem()

TrashService.php : 35

Loads a trashed location object from its $id.

public loadTrashItem(int $trashItemId) : TrashItem

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

Parameters

Name Type Default value Description
$trashItemId int - -

Return values

TrashItem

Tags
Throws
UnauthorizedException

if the user is not allowed to read the trashed location

Throws
NotFoundException
  • if the location with the given id does not exist

publicrecover()

TrashService.php : 63

Recovers the $trashedLocation at its original place if possible.

public recover(TrashItem $trashItem[, Location $newParentLocation = null ]) : Location

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

Parameters

Name Type Default value Description
$trashItem TrashItem - -
$newParentLocation Location null -

Return values

Location

the newly created or recovered location

Tags
Throws
UnauthorizedException

if the user is not allowed to recover the trash item at the parent location location

publictrash()

TrashService.php : 49

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

public trash(Location $location) : TrashItem|null

The current user may not have access to the returned trash item, check before using it. Content is left untouched.

Parameters

Name Type Default value Description
$location Location - -

Return values

TrashItem|null

null if location was deleted, otherwise TrashItem

Tags
Throws
UnauthorizedException

if the user is not allowed to trash the given location