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


PHP RepositoryInterface::findOneBy方法代码示例

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


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

示例1: getActivedProvider

 /**
  * @return null|ProviderInterface
  */
 public function getActivedProvider()
 {
     if ($provider = $this->repository->findOneBy(array('actived' => true))) {
         return $provider;
     }
     return $this->findByName($this->defaultProvider);
 }
开发者ID:liverbool,项目名称:dos-sms-bundle,代码行数:10,代码来源:ProviderProvider.php

示例2: validate

 /**
  * {@inheritdoc}
  */
 public function validate($customer, Constraint $constraint)
 {
     $existingCustomer = $this->customerRepository->findOneBy(['email' => $customer->getEmail()]);
     if (null !== $existingCustomer && null !== $existingCustomer->getUser()) {
         $this->context->addViolationAt('email', $constraint->message, [], null);
     }
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:RegisteredUserValidator.php

示例3: reverseTransform

 /**
  * {@inheritdoc}
  */
 public function reverseTransform($code)
 {
     if (null === $code || '' === $code) {
         return null;
     }
     return $this->promotionCouponRepository->findOneBy(['code' => $code]);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:10,代码来源:PromotionCouponToCodeType.php

示例4: getPermission

 /**
  * {@inheritdoc}
  */
 public function getPermission($code)
 {
     if (null === ($permission = $this->repository->findOneBy(array('code' => $code)))) {
         throw new PermissionNotFoundException($code);
     }
     return $permission;
 }
开发者ID:lingoda,项目名称:Sylius,代码行数:10,代码来源:PermissionProvider.php

示例5: getCountryByName

 /**
  * @Transform /^country "([^"]+)"$/
  * @Transform /^"([^"]+)" country$/
  * @Transform /^"([^"]+)" as shipping country$/
  */
 public function getCountryByName($countryName)
 {
     $countryCode = $this->countryNameConverter->convertToCode($countryName);
     $country = $this->countryRepository->findOneBy(['code' => $countryCode]);
     Assert::notNull($country, sprintf('Country with name "%s" does not exist', $countryName));
     return $country;
 }
开发者ID:loic425,项目名称:Sylius,代码行数:12,代码来源:CountryContext.php

示例6: iAddedProductToTheCart

 /**
  * @Given I added product :name to the cart
  */
 public function iAddedProductToTheCart($name)
 {
     /** @var ProductInterface $product */
     $product = $this->productRepository->findOneBy(array('name' => $name));
     $productShowPage = $this->getPage('Product\\ProductShowPage')->openSpecificProductPage($product);
     $productShowPage->addToCart();
 }
开发者ID:Spomky,项目名称:Sylius,代码行数:10,代码来源:CheckoutContext.php

示例7: execute

 /**
  * {@inheritDoc}
  *
  * @param $request Notify
  */
 public function execute($request)
 {
     if (!$this->supports($request)) {
         throw RequestNotSupportedException::createActionNotSupported($this, $request);
     }
     $this->payment->execute($httpRequest = new GetHttpRequest());
     $details = $httpRequest->query;
     if (!$this->api->verifyHash($details)) {
         throw new BadRequestHttpException('Hash cannot be verified.');
     }
     if (empty($details['ORDERID'])) {
         throw new BadRequestHttpException('Order id cannot be guessed');
     }
     $payment = $this->paymentRepository->findOneBy(array($this->identifier => $details['ORDERID']));
     if (null === $payment) {
         throw new BadRequestHttpException('Payment cannot be retrieved.');
     }
     if ((int) $details['AMOUNT'] !== $payment->getAmount()) {
         throw new BadRequestHttpException('Request amount cannot be verified against payment amount.');
     }
     // Actually update payment details
     $details = array_merge($payment->getDetails(), $details);
     $payment->setDetails($details);
     $status = new GetStatus($payment);
     $this->payment->execute($status);
     $nextState = $status->getValue();
     $this->updatePaymentState($payment, $nextState);
     $this->objectManager->flush();
     throw new HttpResponse(new Response('OK', 200));
 }
开发者ID:nanyi,项目名称:Sylius,代码行数:35,代码来源:NotifyAction.php

示例8: update

 /**
  * {@inheritdoc}
  */
 public function update(OrderInterface $order)
 {
     /** @var CurrencyInterface $currency */
     $currency = $this->currencyRepository->findOneBy(['code' => $this->currencyContext->getCurrencyCode()]);
     $order->setCurrencyCode($currency->getCode());
     $order->setExchangeRate($currency->getExchangeRate());
 }
开发者ID:origammi,项目名称:Sylius,代码行数:10,代码来源:OrderExchangeRateAndCurrencyUpdater.php

示例9: getCurrency

 private function getCurrency($code)
 {
     if (isset($this->cache[$code])) {
         return $this->cache[$code];
     }
     return $this->cache[$code] = $this->currencyRepository->findOneBy(array('code' => $code));
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:7,代码来源:CurrencyConverter.php

示例10: isUsedCode

 /**
  * @param string $token
  *
  * @return Boolean
  */
 protected function isUsedCode($token)
 {
     $this->manager->getFilters()->disable('softdeleteable');
     $isUsed = null !== $this->repository->findOneBy(array('confirmationToken' => $token));
     $this->manager->getFilters()->enable('softdeleteable');
     return $isUsed;
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:12,代码来源:TokenProvider.php

示例11: getCurrency

 /**
  * @param string $code
  *
  * @return CurrencyInterface
  */
 protected function getCurrency($code)
 {
     if (isset($this->cache[$code])) {
         return $this->cache[$code];
     }
     return $this->cache[$code] = $this->currencyRepository->findOneBy(['code' => $code]);
 }
开发者ID:polisys,项目名称:Sylius,代码行数:12,代码来源:CurrencyConverter.php

示例12:

 function it_returns_null_if_metadata_is_not_found(RepositoryInterface $metadataContainerRepository, MetadataCompilerInterface $metadataCompiler, MetadataHierarchyProviderInterface $metadataHierarchyProvider, MetadataSubjectInterface $metadataSubject)
 {
     $metadataHierarchyProvider->getHierarchyByMetadataSubject($metadataSubject)->shouldBeCalled()->willReturn(['MetadataSubject-42', 'MetadataSubject']);
     $metadataContainerRepository->findOneBy(['id' => 'MetadataSubject-42'])->shouldBeCalled()->willReturn(null);
     $metadataContainerRepository->findOneBy(['id' => 'MetadataSubject'])->shouldBeCalled()->willReturn(null);
     $metadataCompiler->compile(Argument::cetera())->shouldNotBeCalled();
     $this->findMetadataBySubject($metadataSubject)->shouldReturn(null);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:8,代码来源:MetadataProviderSpec.php

示例13: castProductNameToProduct

 /**
  * @Transform /^product "([^"]+)"$/
  * @Transform /^"([^"]+)" product$/
  */
 public function castProductNameToProduct($productName)
 {
     $product = $this->productRepository->findOneBy(['name' => $productName]);
     if (null === $product) {
         throw new \InvalidArgumentException('Product with name "' . $productName . '" does not exist');
     }
     return $product;
 }
开发者ID:andrew-pits,项目名称:Sylius,代码行数:12,代码来源:ProductContext.php

示例14: getZoneByCode

 /**
  * @Transform :zone zone
  * @Transform zone :zone
  */
 public function getZoneByCode($zone)
 {
     $existingZone = $this->zoneRepository->findOneBy(['code' => $zone]);
     if (null === $existingZone) {
         throw new \InvalidArgumentException(sprintf('Zone with code "%s" does not exist', $zone));
     }
     return $existingZone;
 }
开发者ID:weppyk,项目名称:Sylius,代码行数:12,代码来源:ZoneContext.php

示例15: getTaxRateByName

 /**
  * @Transform :taxRate
  */
 public function getTaxRateByName($taxRateName)
 {
     $taxRate = $this->taxRateRepository->findOneBy(['name' => $taxRateName]);
     if (null === $taxRate) {
         throw new \InvalidArgumentException(sprintf('Tax rate with name "%s" does not exist.', $taxRateName));
     }
     return $taxRate;
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:11,代码来源:TaxRateContext.php


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