当前位置: 首页>>代码示例>>PHP>>正文


PHP RepositoryInterface::remove方法代码示例

本文整理汇总了PHP中Sylius\Component\Resource\Repository\RepositoryInterface::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP RepositoryInterface::remove方法的具体用法?PHP RepositoryInterface::remove怎么用?PHP RepositoryInterface::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Component\Resource\Repository\RepositoryInterface的用法示例。


在下文中一共展示了RepositoryInterface::remove方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: iDeleteTheProduct

 /**
  * @When /^I delete the ("[^"]+" product)$/
  * @When /^I try to delete the ("([^"]+)" product)$/
  */
 public function iDeleteTheProduct(ProductInterface $product)
 {
     try {
         $this->sharedStorage->set('product_id', $product->getId());
         $this->productRepository->remove($product);
     } catch (DBALException $exception) {
         $this->sharedStorage->set('last_exception', $exception);
     }
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:13,代码来源:ManagingProductsContext.php

示例2:

 function it_throws_exception_while_trying_to_remove_a_coupon_and_actually_removing_it(SharedStorageInterface $sharedStorage, RepositoryInterface $couponRepository, CouponInterface $coupon)
 {
     $coupon->getId()->willReturn(5);
     $couponRepository->remove($coupon)->shouldBeCalled();
     $sharedStorage->set('last_exception', Argument::any())->shouldNotBeCalled();
     $this->shouldThrow(\Exception::class)->during('iTryToDeleteCoupon', [$coupon]);
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:7,代码来源:PromotionContextSpec.php

示例3: theStoreDoesNotHaveAnyZonesDefined

 /**
  * @Given the store does not have any zones defined
  */
 public function theStoreDoesNotHaveAnyZonesDefined()
 {
     $zones = $this->zoneRepository->findAll();
     foreach ($zones as $zone) {
         $this->zoneRepository->remove($zone);
     }
 }
开发者ID:sylius,项目名称:sylius,代码行数:10,代码来源:ZoneContext.php

示例4: theStoreDoesNotHaveLocale

 /**
  * @Given the locale :localeCode does not exist in the store
  */
 public function theStoreDoesNotHaveLocale($localeCode)
 {
     /** @var LocaleInterface $locale */
     $locale = $this->localeRepository->findOneBy(['code' => $localeCode]);
     if (null !== $locale) {
         $this->localeRepository->remove($locale);
     }
 }
开发者ID:loic425,项目名称:Sylius,代码行数:11,代码来源:LocaleContext.php

示例5: deleteAction

 /**
  * @param Request $request
  *
  * @return Response
  */
 public function deleteAction(Request $request)
 {
     $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);
     $this->isGrantedOr403($configuration, ResourceActions::DELETE);
     $resource = $this->findOr404($configuration);
     $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::DELETE, $configuration, $resource);
     if ($event->isStopped() && !$configuration->isHtmlRequest()) {
         throw new HttpException($event->getErrorCode(), $event->getMessage());
     }
     if ($event->isStopped()) {
         $this->flashHelper->addFlashFromEvent($configuration, $event);
         return $this->redirectHandler->redirectToIndex($configuration, $resource);
     }
     $this->repository->remove($resource);
     $this->eventDispatcher->dispatchPostEvent(ResourceActions::DELETE, $configuration, $resource);
     if (!$configuration->isHtmlRequest()) {
         return $this->viewHandler->handle($configuration, View::create(null, 204));
     }
     $this->flashHelper->addSuccessFlash($configuration, ResourceActions::DELETE, $resource);
     return $this->redirectHandler->redirectToIndex($configuration, $resource);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:26,代码来源:ResourceController.php

示例6: deleteAction

 /**
  * @param Request $request
  *
  * @return Response
  */
 public function deleteAction(Request $request)
 {
     $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);
     $this->isGrantedOr403($configuration, ResourceActions::DELETE);
     $resource = $this->findOr404($configuration);
     if ($configuration->isCsrfProtectionEnabled() && !$this->isCsrfTokenValid($resource->getId(), $request->get('_csrf_token'))) {
         throw new HttpException(Response::HTTP_FORBIDDEN, 'Invalid csrf token.');
     }
     $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::DELETE, $configuration, $resource);
     if ($event->isStopped() && !$configuration->isHtmlRequest()) {
         throw new HttpException($event->getErrorCode(), $event->getMessage());
     }
     if ($event->isStopped()) {
         $this->flashHelper->addFlashFromEvent($configuration, $event);
         return $this->redirectHandler->redirectToIndex($configuration, $resource);
     }
     $this->repository->remove($resource);
     $this->eventDispatcher->dispatchPostEvent(ResourceActions::DELETE, $configuration, $resource);
     if (!$configuration->isHtmlRequest()) {
         return $this->viewHandler->handle($configuration, View::create(null, Response::HTTP_NO_CONTENT));
     }
     $this->flashHelper->addSuccessFlash($configuration, ResourceActions::DELETE, $resource);
     return $this->redirectHandler->redirectToIndex($configuration, $resource);
 }
开发者ID:sylius,项目名称:sylius,代码行数:29,代码来源:ResourceController.php

示例7: iDeleteCoupon

 /**
  * @When /^I delete ("([^"]+)" coupon)$/
  */
 public function iDeleteCoupon(CouponInterface $coupon)
 {
     $this->sharedStorage->set('coupon', $coupon);
     $this->couponRepository->remove($coupon);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:8,代码来源:PromotionContext.php

示例8: accountWasDeleted

 /**
  * @Given the account of :email was deleted
  */
 public function accountWasDeleted($email)
 {
     $user = $this->userRepository->findOneByEmail($email);
     $this->sharedStorage->set('customer', $user->getCustomer());
     $this->userRepository->remove($user);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:9,代码来源:UserContext.php

示例9:

 function it_tries_to_delete_a_product_that_does_not_exist(SharedStorageInterface $sharedStorage, RepositoryInterface $productRepository, ProductInterface $product)
 {
     $product->getId()->willReturn(1);
     $productRepository->find(1)->willReturn(null);
     $sharedStorage->set('deleted_product', $product)->shouldBeCalled();
     $productRepository->remove($product)->willThrow(DBALException::class);
     $sharedStorage->set('last_exception', Argument::type(DBALException::class))->shouldBeCalled();
     $this->iDeleteTheProduct($product);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:9,代码来源:ProductContextSpec.php


注:本文中的Sylius\Component\Resource\Repository\RepositoryInterface::remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。