Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>tags/v21.0.0beta3
$deletedShares = array_merge($deletedShares, $deletedChildren); | $deletedShares = array_merge($deletedShares, $deletedChildren); | ||||
$provider->delete($child); | $provider->delete($child); | ||||
$this->dispatcher->dispatchTyped(new Share\Events\ShareDeletedEvent($child)); | |||||
$deletedShares[] = $child; | $deletedShares[] = $child; | ||||
} | } | ||||
$provider = $this->factory->getProviderForType($share->getShareType()); | $provider = $this->factory->getProviderForType($share->getShareType()); | ||||
$provider->delete($share); | $provider->delete($share); | ||||
$this->dispatcher->dispatchTyped(new Share\Events\ShareDeletedEvent($share, $deletedShares)); | |||||
$this->dispatcher->dispatchTyped(new Share\Events\ShareDeletedEvent($share)); | |||||
// All the deleted shares caused by this delete | // All the deleted shares caused by this delete | ||||
$deletedShares[] = $share; | $deletedShares[] = $share; |
/** @var IShare */ | /** @var IShare */ | ||||
private $share; | private $share; | ||||
/** @var IShare[] */ | |||||
private $children; | |||||
/** | /** | ||||
* | * | ||||
* @param IShare $share | * @param IShare $share | ||||
* | * | ||||
* @since 21.0.0 | * @since 21.0.0 | ||||
*/ | */ | ||||
public function __construct(IShare $share, array $children = []) { | |||||
public function __construct(IShare $share) { | |||||
parent::__construct(); | parent::__construct(); | ||||
$this->share = $share; | $this->share = $share; | ||||
$this->children = $children; | |||||
} | } | ||||
/** | /** | ||||
public function getShare(): IShare { | public function getShare(): IShare { | ||||
return $this->share; | return $this->share; | ||||
} | } | ||||
/** | |||||
* @return IShare[] | |||||
* @since 21.0.0 | |||||
*/ | |||||
public function getChildren(): array { | |||||
return $this->children; | |||||
} | |||||
/** | |||||
* @return IShare[] | |||||
* @since 21.0.0 | |||||
*/ | |||||
public function getAllDeletedShares(): array { | |||||
return array_merge([$this->share], $this->children); | |||||
} | |||||
} | } |