| @@ 19-40 (lines=22) @@ | ||
| 16 | /** |
|
| 17 | * A Search Engine slot handling DeleteContentSignal. |
|
| 18 | */ |
|
| 19 | class DeleteContent extends Slot |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * Receive the given $signal and react on it. |
|
| 23 | * |
|
| 24 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
|
| 25 | */ |
|
| 26 | public function receive(Signal $signal) |
|
| 27 | { |
|
| 28 | if (!$signal instanceof Signal\ContentService\DeleteContentSignal) { |
|
| 29 | return; |
|
| 30 | } |
|
| 31 | ||
| 32 | // Delete Content |
|
| 33 | $this->searchHandler->deleteContent($signal->contentId); |
|
| 34 | ||
| 35 | // Delete locations if there is any |
|
| 36 | foreach ($signal->affectedLocationIds as $locationId) { |
|
| 37 | $this->searchHandler->deleteLocation($locationId, $signal->contentId); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| @@ 17-38 (lines=22) @@ | ||
| 14 | /** |
|
| 15 | * A Search Engine slot handling DeleteUserSignal. |
|
| 16 | */ |
|
| 17 | class DeleteUser extends Slot |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Receive the given $signal and react on it. |
|
| 21 | * |
|
| 22 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
|
| 23 | */ |
|
| 24 | public function receive(Signal $signal) |
|
| 25 | { |
|
| 26 | if (!$signal instanceof Signal\UserService\DeleteUserSignal) { |
|
| 27 | return; |
|
| 28 | } |
|
| 29 | ||
| 30 | // Delete Content |
|
| 31 | $this->searchHandler->deleteContent($signal->userId); |
|
| 32 | ||
| 33 | // Delete locations if there is any |
|
| 34 | foreach ($signal->affectedLocationIds as $locationId) { |
|
| 35 | $this->searchHandler->deleteLocation($locationId, $signal->userId); |
|
| 36 | } |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||
| @@ 17-38 (lines=22) @@ | ||
| 14 | /** |
|
| 15 | * A Search Engine slot handling DeleteUserGroupSignal. |
|
| 16 | */ |
|
| 17 | class DeleteUserGroup extends Slot |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Receive the given $signal and react on it. |
|
| 21 | * |
|
| 22 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
|
| 23 | */ |
|
| 24 | public function receive(Signal $signal) |
|
| 25 | { |
|
| 26 | if (!$signal instanceof Signal\UserService\DeleteUserGroupSignal) { |
|
| 27 | return; |
|
| 28 | } |
|
| 29 | ||
| 30 | // Delete Content |
|
| 31 | $this->searchHandler->deleteContent($signal->userGroupId); |
|
| 32 | ||
| 33 | // Delete locations if there is any |
|
| 34 | foreach ($signal->affectedLocationIds as $locationId) { |
|
| 35 | $this->searchHandler->deleteLocation($locationId, $signal->userGroupId); |
|
| 36 | } |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||
| @@ 19-43 (lines=25) @@ | ||
| 16 | /** |
|
| 17 | * A Search Engine slot handling TrashSignal. |
|
| 18 | */ |
|
| 19 | class Trash extends Slot |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * Receive the given $signal and react on it. |
|
| 23 | * |
|
| 24 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
|
| 25 | */ |
|
| 26 | public function receive(Signal $signal) |
|
| 27 | { |
|
| 28 | if (!$signal instanceof Signal\TrashService\TrashSignal) { |
|
| 29 | return; |
|
| 30 | } |
|
| 31 | ||
| 32 | if ($signal->contentTrashed) { |
|
| 33 | $this->searchHandler->deleteContent( |
|
| 34 | $signal->contentId |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | ||
| 38 | $this->searchHandler->deleteLocation( |
|
| 39 | $signal->locationId, |
|
| 40 | $signal->contentId |
|
| 41 | ); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||