Skip to content

Commit

Permalink
EZP-29997: Exposed information about removed content items in EmptyTr…
Browse files Browse the repository at this point in the history
…ashSignal and DeleteTrashItemSignal (#2520)

* EZP-29997: Expose information about removed content items in EmptyTrashSignal and DeleteTrashItemSignal

* EZP-29997: Fix and update unit tests

* EZP-29997: Made changes according to code review

* Fixed unit tests
  • Loading branch information
webhdx authored and Łukasz Serwatka committed Jan 14, 2019
1 parent fcd784d commit 1590bac
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Repository/TrashService.php
Expand Up @@ -66,6 +66,8 @@ public function recover(TrashItem $trashItem, Location $newParentLocation = null
* if all locations of the content are gone.
*
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to empty the trash
*
* @return \eZ\Publish\API\Repository\Values\Content\Trash\TrashItemDeleteResultList
*/
public function emptyTrash();

Expand All @@ -77,6 +79,8 @@ public function emptyTrash();
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete this trash item
*
* @param \eZ\Publish\API\Repository\Values\Content\TrashItem $trashItem
*
* @return \eZ\Publish\API\Repository\Values\Content\Trash\TrashItemDeleteResult
*/
public function deleteTrashItem(TrashItem $trashItem);

Expand Down
29 changes: 29 additions & 0 deletions Repository/Values/Content/Trash/TrashItemDeleteResult.php
@@ -0,0 +1,29 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\API\Repository\Values\Content\Trash;

use eZ\Publish\API\Repository\Values\ValueObject;

class TrashItemDeleteResult extends ValueObject
{
/**
* @var int
*/
public $trashItemId;

/**
* @var int
*/
public $contentId;

/**
* Flag indicating content was removed.
*
* @var bool
*/
public $contentRemoved = false;
}
25 changes: 25 additions & 0 deletions Repository/Values/Content/Trash/TrashItemDeleteResultList.php
@@ -0,0 +1,25 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\API\Repository\Values\Content\Trash;

use eZ\Publish\API\Repository\Values\ValueObject;

class TrashItemDeleteResultList extends ValueObject implements \IteratorAggregate
{
/**
* @var \eZ\Publish\API\Repository\Values\Content\Trash\TrashItemDeleteResult[]
*/
public $items = [];

/**
* @return \ArrayIterator
*/
public function getIterator()
{
return new \ArrayIterator($this->items);
}
}

0 comments on commit 1590bac

Please sign in to comment.