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


PHP Repository\RepositoryInterface类代码示例

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


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

示例1:

 function it_creates_a_default_united_states_channel_with_country_zone_and_usd_as_default_currency(RepositoryInterface $channelRepository, RepositoryInterface $countryRepository, RepositoryInterface $currencyRepository, RepositoryInterface $localeRepository, RepositoryInterface $zoneMemberRepository, RepositoryInterface $zoneRepository, ChannelFactoryInterface $channelFactory, FactoryInterface $countryFactory, FactoryInterface $currencyFactory, FactoryInterface $localeFactory, FactoryInterface $zoneFactory, FactoryInterface $zoneMemberFactory, ZoneMemberInterface $zoneMember, ZoneInterface $zone, ChannelInterface $channel, CountryInterface $unitedStates, CurrencyInterface $currency, LocaleInterface $locale)
 {
     $channel->getName()->willReturn('United States');
     $channelFactory->createNamed('United States')->willReturn($channel);
     $localeFactory->createNew()->willReturn($locale);
     $locale->setCode('en_US')->shouldBeCalled();
     $zoneMemberFactory->createNew()->willReturn($zoneMember);
     $zoneFactory->createNew()->willReturn($zone);
     $channel->setCode('WEB-US')->shouldBeCalled();
     $channel->setTaxCalculationStrategy('order_items_based')->shouldBeCalled();
     $zoneMember->setCode('US')->shouldBeCalled();
     $zone->setCode('US')->shouldBeCalled();
     $zone->setName('United States')->shouldBeCalled();
     $zone->setType(ZoneInterface::TYPE_COUNTRY)->shouldBeCalled();
     $zone->addMember($zoneMember)->shouldBeCalled();
     $countryFactory->createNew()->willReturn($unitedStates);
     $unitedStates->setCode('US')->shouldBeCalled();
     $currencyFactory->createNew()->willReturn($currency);
     $currency->setCode('USD')->shouldBeCalled();
     $currency->setExchangeRate(1.0)->shouldBeCalled();
     $channel->setDefaultCurrency($currency)->shouldBeCalled();
     $channel->addCurrency($currency)->shouldBeCalled();
     $channel->setDefaultLocale($locale)->shouldBeCalled();
     $channel->addLocale($locale)->shouldBeCalled();
     $currencyRepository->findOneBy(['code' => 'USD'])->willReturn(null);
     $localeRepository->findOneBy(['code' => 'en_US'])->willReturn(null);
     $currencyRepository->add($currency)->shouldBeCalled();
     $localeRepository->add($locale)->shouldBeCalled();
     $countryRepository->add($unitedStates)->shouldBeCalled();
     $channelRepository->add($channel)->shouldBeCalled();
     $zoneRepository->add($zone)->shouldBeCalled();
     $zoneMemberRepository->add($zoneMember)->shouldBeCalled();
     $this->create();
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:34,代码来源:DefaultUnitedStatesChannelFactorySpec.php

示例2:

 function it_calls_proper_method_with_arguments_based_on_configuration(RepositoryInterface $repository, $configuration)
 {
     $configuration->getRepositoryMethod('findBy')->willReturn('findAll');
     $configuration->getRepositoryArguments(array())->willReturn(array(5));
     $repository->findAll(5)->shouldBeCalled()->willReturn(array('foo', 'bar'));
     $this->getResource($repository, 'findBy')->shouldReturn(array('foo', 'bar'));
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:7,代码来源:ResourceResolverSpec.php

示例3:

 function it_uses_a_custom_method_if_configured(RequestConfiguration $requestConfiguration, RepositoryInterface $repository, ResourceInterface $resource)
 {
     $requestConfiguration->getRepositoryMethod()->willReturn('findAll');
     $requestConfiguration->getRepositoryArguments()->willReturn(array('foo'));
     $repository->findAll('foo')->willReturn($resource);
     $this->get($requestConfiguration, $repository)->shouldReturn($resource);
 }
开发者ID:Spomky,项目名称:Sylius,代码行数:7,代码来源:SingleResourceProviderSpec.php

示例4:

 function it_checks_if_the_locale_is_available(RepositoryInterface $repository, LocaleInterface $locale)
 {
     $repository->findBy(Argument::any())->willReturn(array($locale));
     $locale->getCode()->willReturn('en');
     $this->isLocaleAvailable('en')->shouldReturn(true);
     $this->isLocaleAvailable('fr')->shouldReturn(false);
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:7,代码来源:LocaleProviderSpec.php

示例5:

 function it_does_not_add_customer_if_they_not_exist(FormEvent $event, RepositoryInterface $customerRepository, FormInterface $form)
 {
     $event->getData()->willReturn(['email' => 'imno@example.com']);
     $customerRepository->findOneBy(['email' => 'imno@example.com'])->willReturn(null);
     $form->setData(null)->shouldNotBeCalled();
     $this->preSubmit($event);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:7,代码来源:SetCustomerFormSubscriberSpec.php

示例6:

 function it_creates_a_taxon_and_assigns_a_taxonomy_to_id(FactoryInterface $factory, RepositoryInterface $taxonomyRepository, TaxonomyInterface $taxonomy, TaxonInterface $taxon)
 {
     $factory->createNew()->willReturn($taxon);
     $taxonomyRepository->find(13)->willReturn($taxonomy);
     $taxon->setTaxonomy($taxonomy)->shouldBeCalled();
     $this->createForTaxonomy(13)->shouldReturn($taxon);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:7,代码来源:TaxonFactorySpec.php

示例7: create

 /**
  * {@inheritdoc}
  */
 public function create()
 {
     $channel = $this->channelFactory->createNamed(self::DEFAULT_CHANNEL_NAME);
     $channel->setCode(self::DEFAULT_CHANNEL_CODE);
     $this->channelRepository->add($channel);
     return ['channel' => $channel];
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:10,代码来源:DefaultChannelFactory.php

示例8: 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

示例9: 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

示例10: getAvailableCurrenciesCodes

 /**
  * {@inheritdoc}
  */
 public function getAvailableCurrenciesCodes()
 {
     $currencies = $this->currencyRepository->findBy(['enabled' => true]);
     return array_map(function (CurrencyInterface $currency) {
         return $currency->getCode();
     }, $currencies);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:CurrencyProvider.php

示例11: 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

示例12: theStoreHasDisabledCountry

 /**
  * @Given /^the store has disabled country "([^"]*)"$/
  */
 public function theStoreHasDisabledCountry($countryName)
 {
     $country = $this->createCountryNamed(trim($countryName));
     $country->disable();
     $this->sharedStorage->set('country', $country);
     $this->countryRepository->add($country);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:10,代码来源:GeographicalContext.php

示例13: 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

示例14: getZones

 /**
  * @param array $options
  *
  * @return array
  */
 private function getZones(array $options)
 {
     if (isset($options['scope'])) {
         return $this->zoneRepository->findBy(['scope' => $options['scope']]);
     }
     return $this->zoneRepository->findAll();
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:12,代码来源:ZoneBasedConfigurationType.php

示例15: 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


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