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


PHP RepositoryInterface::findBy方法代码示例

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


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

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

示例2: getAvailableLocalesCodes

 /**
  * {@inheritdoc}
  */
 public function getAvailableLocalesCodes()
 {
     $locales = $this->localeRepository->findBy(['enabled' => true]);
     return array_map(function (LocaleInterface $locale) {
         return $locale->getCode();
     }, $locales);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:10,代码来源:LocaleProvider.php

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

示例4: getCart

 public function getCart()
 {
     $user = $this->getUser();
     $carts = $this->cartRepository->findBy(['user' => $user, 'expiresAt' => null, 'state' => 'cart'], ['createdAt' => 'DESC'], 1);
     if (count($carts)) {
         return $carts[0];
     }
     return null;
 }
开发者ID:enhavo,项目名称:enhavo,代码行数:9,代码来源:UserCartProvider.php

示例5: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(['choices' => function (Options $options) {
         if (null === $options['enabled']) {
             return $this->countryRepository->findAll();
         }
         return $this->countryRepository->findBy(['enabled' => $options['enabled']]);
     }, 'choice_value' => 'code', 'choice_label' => 'name', 'choice_translation_domain' => false, 'enabled' => true, 'label' => 'sylius.form.address.country', 'placeholder' => 'sylius.form.country.select']);
 }
开发者ID:sylius,项目名称:sylius,代码行数:12,代码来源:CountryChoiceType.php

示例6: getEnabledLocalesCodes

 /**
  * @return string[]
  */
 protected function getEnabledLocalesCodes()
 {
     $localesCodes = array();
     /** @var LocaleInterface[] $locales */
     $locales = $this->localeRepository->findBy(array('enabled' => true));
     foreach ($locales as $locale) {
         $localesCodes[] = $locale->getCode();
     }
     return $localesCodes;
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:13,代码来源:LocaleProvider.php

示例7: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $choices = function (Options $options) {
         if (null === $options['customer']) {
             return $this->addressRepository->findAll();
         }
         return $this->addressRepository->findBy(['customer' => $options['customer']]);
     };
     $resolver->setDefaults(['class' => AddressInterface::class, 'choices' => $choices, 'customer' => null, 'label' => false, 'placeholder' => false]);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:13,代码来源:AddressChoiceType.php

示例8: getAvailableLocales

 /**
  * @return array
  */
 public function getAvailableLocales()
 {
     $localesCodes = [];
     /** @var LocaleInterface[] $locales */
     $locales = $this->localeRepository->findBy(['enabled' => true]);
     foreach ($locales as $locale) {
         $localesCodes[] = $locale->getCode();
     }
     return $localesCodes;
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:13,代码来源:AvailableLocalesProvider.php

示例9: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $choices = [];
     /** @var CurrencyInterface[] $currencies */
     $currencies = $this->currencyRepository->findBy(['enabled' => true]);
     foreach ($currencies as $currency) {
         $choices[$currency->getCode()] = sprintf('%s - %s', $currency->getCode(), $currency->getName());
     }
     $resolver->setDefaults(['choice_translation_domain' => false, 'choices' => $choices]);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:13,代码来源:CurrencyCodeChoiceType.php

示例10: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(['choices' => function (Options $options) {
         if (null === $options['enabled']) {
             return $this->localeRepository->findAll();
         }
         return $this->localeRepository->findBy(['enabled' => $options['enabled']]);
     }, 'choice_value' => 'code', 'choice_label' => 'name', 'choice_translation_domain' => false, 'enabled' => null, 'label' => 'sylius.form.locale.locale', 'placeholder' => 'sylius.form.locale.select']);
 }
开发者ID:sylius,项目名称:sylius,代码行数:13,代码来源:LocaleChoiceType.php

示例11: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $choices = function (Options $options) {
         if (null === $options['enabled']) {
             $countries = $this->countryRepository->findAll();
         } else {
             $countries = $this->countryRepository->findBy(['enabled' => $options['enabled']]);
         }
         return $this->getCountryCodes($countries);
     };
     $resolver->setDefaults(['choices' => $choices, 'choices_as_values' => true, 'enabled' => true, 'label' => 'sylius.form.address.country', 'empty_value' => 'sylius.form.country.select']);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:15,代码来源:CountryCodeChoiceType.php

示例12: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $choices = function (Options $options) {
         if (null === $options['enabled']) {
             $choices = $this->countryRepository->findAll();
         } else {
             $choices = $this->countryRepository->findBy(['enabled' => $options['enabled']]);
         }
         return new ArrayChoiceList($choices);
     };
     $resolver->setDefaults(['choice_translation_domain' => false, 'choice_list' => $choices, 'enabled' => true, 'label' => 'sylius.form.address.country', 'empty_value' => 'sylius.form.country.select']);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:15,代码来源:CountryChoiceType.php

示例13: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $choiceList = function (Options $options) {
         if (isset($options['subject'])) {
             $methods = $this->resolver->getSupportedMethods($options['subject'], $options['criteria']);
         } else {
             $methods = $this->repository->findBy($options['criteria']);
         }
         return new ObjectChoiceList($methods, null, [], null, 'id');
     };
     $resolver->setDefaults(['choice_list' => $choiceList, 'criteria' => []])->setDefined(['subject'])->setAllowedTypes('subject', ShippingSubjectInterface::class)->setAllowedTypes('criteria', 'array');
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:15,代码来源:ShippingMethodChoiceType.php

示例14: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $choiceList = function (Options $options) {
         if (null === $options['enabled']) {
             $choices = $this->localeRepository->findAll();
         } else {
             $choices = $this->localeRepository->findBy(array('enabled' => $options['enabled']));
         }
         return new ObjectChoiceList($choices, null, array(), null, 'id');
     };
     $resolver->setDefaults(array('choice_list' => $choiceList, 'enabled' => null, 'label' => 'sylius.form.locale.locale', 'empty_value' => 'sylius.form.locale.select'));
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:15,代码来源:LocaleChoiceType.php

示例15: generateNumber

 private function generateNumber()
 {
     /** @var OrderInterface[] $orders */
     $orders = $this->orderRepository->findBy([], ['createdAt' => 'DESC'], 1);
     if (count($orders)) {
         $number = $orders[0]->getNumber();
         if ($number !== null) {
             $number++;
             return $number;
         }
     }
     return 1;
 }
开发者ID:enhavo,项目名称:enhavo,代码行数:13,代码来源:OrderInitProcessor.php


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