當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。