An instance of this class is required by each object that needs to send Signals. It is recommended, that a SignalDispatcher works together with a {@link SlotFactory} to get hold of the actual Slots that listen for a given Signal, which it originally only knows by their identifier.
コード例 #1
0
ファイル: Repository.php プロジェクト: CG77/ezpublish-kernel
 /**
  * Rollback transaction
  *
  * Rollback transaction, or throw exceptions if no transactions has been started.
  *
  * @throws \RuntimeException If no transaction has been started
  */
 public function rollback()
 {
     if ($this->signalDispatcher instanceof TransactionHandler) {
         $this->signalDispatcher->rollback();
     }
     return $this->repository->rollback();
 }
コード例 #2
0
ファイル: TagsServiceTest.php プロジェクト: umanit/TagsBundle
 /**
  * @covers \Netgen\TagsBundle\Core\SignalSlot\TagsService::deleteTag
  */
 public function testDeleteTag()
 {
     $tag = new Tag(array('id' => 42));
     $this->tagsService->expects($this->once())->method('deleteTag')->with($this->equalTo($tag));
     $this->signalDispatcher->expects($this->once())->method('emit')->with($this->equalTo(new DeleteTagSignal(array('tagId' => 42))));
     $signalSlotService = $this->getSignalSlotService();
     $signalSlotService->deleteTag($tag);
 }
コード例 #3
0
ファイル: ContentService.php プロジェクト: ataxel/tp
 /**
  * Adds translation information to the content object
  *
  * @example Examples/translation_5x.php
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed add a translation info
  *
  * @param \eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo
  *
  * @since 5.0
  */
 public function addTranslationInfo( TranslationInfo $translationInfo )
 {
     $returnValue = $this->service->addTranslationInfo( $translationInfo );
     $this->signalDispatcher->emit(
         new AddTranslationInfoSignal( array() )
     );
     return $returnValue;
 }
 /**
  * Captures Commit transaction call and emits queued signals
  */
 public function commit()
 {
     // Ignore if no transaction
     if ($this->transactionDepth === 0) {
         return;
     }
     --$this->transactionDepth;
     if ($this->transactionDepth === 0) {
         foreach ($this->signalsQueue as $signalsQueue) {
             foreach ($signalsQueue as $signal) {
                 $this->signalDispatcher->emit($signal);
             }
         }
         // To avoid possible int overflow on long running processes
         $this->transactionCount = 0;
         $this->signalsQueue = array();
     }
 }
コード例 #5
0
 /**
  * Publish the content type and update content objects.
  *
  * This method updates content objects, depending on the changed field definitions.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If the content type has no draft
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the content type has no field definitions
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to publish a content type
  *
  * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft
  */
 public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft)
 {
     $returnValue = $this->service->publishContentTypeDraft($contentTypeDraft);
     $this->signalDispatcher->emit(new PublishContentTypeDraftSignal(array('contentTypeDraftId' => $contentTypeDraft->id)));
     return $returnValue;
 }
コード例 #6
0
 /**
  * Removes urls aliases.
  *
  * This method does not remove autogenerated aliases for locations.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if alias list contains
  *         autogenerated alias
  *
  * @param \eZ\Publish\API\Repository\Values\Content\URLAlias[] $aliasList
  *
  * @return void
  */
 public function removeAliases(array $aliasList)
 {
     $returnValue = $this->service->removeAliases($aliasList);
     $this->signalDispatcher->emit(new RemoveAliasesSignal(array('aliasList' => $aliasList)));
     return $returnValue;
 }
コード例 #7
0
 /**
  * translates an url to an existing uri resource based on the
  * source/destination patterns of the url wildcard. If the resulting
  * url is an alias it will be translated to the system uri.
  *
  * This method runs also configured url translations and filter
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the url could not be translated
  *
  * @param mixed $url
  *
  * @return \eZ\Publish\API\Repository\Values\Content\URLWildcardTranslationResult
  */
 public function translate($url)
 {
     $returnValue = $this->service->translate($url);
     $this->signalDispatcher->emit(new TranslateSignal(array('url' => $url)));
     return $returnValue;
 }
コード例 #8
0
 /**
  * Deletes $location and all its descendants.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user is not allowed to delete this location or a descendant
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Location $location
  */
 public function deleteLocation(Location $location)
 {
     $this->service->deleteLocation($location);
     $this->signalDispatcher->emit(new DeleteLocationSignal(array('contentId' => $location->contentId, 'locationId' => $location->id)));
 }
コード例 #9
0
 /**
  * Removes a user group from the user
  *
  * @param \eZ\Publish\API\Repository\Values\User\User $user
  * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove the user group from the user
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the user is not in the given user group
  */
 public function unAssignUserFromUserGroup(User $user, UserGroup $userGroup)
 {
     $returnValue = $this->service->unAssignUserFromUserGroup($user, $userGroup);
     $this->signalDispatcher->emit(new UnAssignUserFromUserGroupSignal(array('userId' => $user->id, 'userGroupId' => $userGroup->id)));
     return $returnValue;
 }
コード例 #10
0
 /**
  * removes a role from the given user.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the role is not assigned to the user
  *
  * @param \eZ\Publish\API\Repository\Values\User\Role $role
  * @param \eZ\Publish\API\Repository\Values\User\User $user
  */
 public function unassignRoleFromUser(Role $role, User $user)
 {
     $returnValue = $this->service->unassignRoleFromUser($role, $user);
     $this->signalDispatcher->emit(new UnassignRoleFromUserSignal(array('roleId' => $role->id, 'userId' => $user->id)));
     return $returnValue;
 }
コード例 #11
0
 /**
  * Sets the object-state of a state group to $state for the given content.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the object state does not belong to the given group
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to change the object state
  *
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
  * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup
  * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState
  */
 public function setContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup, ObjectState $objectState)
 {
     $returnValue = $this->service->setContentState($contentInfo, $objectStateGroup, $objectState);
     $this->signalDispatcher->emit(new SetContentStateSignal(array('contentId' => $contentInfo->id, 'objectStateGroupId' => $objectStateGroup->id, 'objectStateId' => $objectState->id)));
     return $returnValue;
 }
コード例 #12
0
 /**
  * Deletes $section from content repository.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the specified section is not found
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to delete a section
  * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException  if section can not be deleted
  *         because it is still assigned to some contents.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Section $section
  */
 public function deleteSection(Section $section)
 {
     $returnValue = $this->service->deleteSection($section);
     $this->signalDispatcher->emit(new DeleteSectionSignal(array('sectionId' => $section->id)));
     return $returnValue;
 }
コード例 #13
0
 /**
  * Deletes a trash item.
  *
  * The corresponding content object will be removed
  *
  * @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
  */
 public function deleteTrashItem(TrashItem $trashItem)
 {
     $returnValue = $this->service->deleteTrashItem($trashItem);
     $this->signalDispatcher->emit(new DeleteTrashItemSignal(array('trashItemId' => $trashItem->id)));
     return $returnValue;
 }
コード例 #14
0
 /**
  * Deletes  a language from content repository
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
  *         if language can not be deleted
  *         because it is still assigned to some content / type / (...).
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user is not allowed to delete a language
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Language $language
  */
 public function deleteLanguage(Language $language)
 {
     $returnValue = $this->service->deleteLanguage($language);
     $this->signalDispatcher->emit(new DeleteLanguageSignal(array('languageId' => $language->id)));
     return $returnValue;
 }
コード例 #15
0
 /**
  * Deletes $tag and all its descendants and synonyms.
  *
  * If $tag is a synonym, only the synonym is deleted
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user is not allowed to delete this tag
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the specified tag is not found
  *
  * @param \Netgen\TagsBundle\API\Repository\Values\Tags\Tag $tag
  */
 public function deleteTag(Tag $tag)
 {
     $this->service->deleteTag($tag);
     $this->signalDispatcher->emit(new DeleteTagSignal(array('tagId' => $tag->id)));
 }
コード例 #16
0
ファイル: RoleService.php プロジェクト: Pixy/ezpublish-kernel
 /**
  * Removes the given role assignment.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role assignment
  *
  * @param \eZ\Publish\API\Repository\Values\User\RoleAssignment $roleAssignment
  */
 public function removeRoleAssignment(RoleAssignment $roleAssignment)
 {
     $returnValue = $this->service->removeRoleAssignment($roleAssignment);
     $this->signalDispatcher->emit(new RemoveRoleAssignmentSignal(['roleAssignmentId' => $roleAssignment->id]));
     return $returnValue;
 }