本文整理汇总了PHP中Sylius\Component\Resource\Repository\RepositoryInterface::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP RepositoryInterface::findAll方法的具体用法?PHP RepositoryInterface::findAll怎么用?PHP RepositoryInterface::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\Resource\Repository\RepositoryInterface
的用法示例。
在下文中一共展示了RepositoryInterface::findAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: getDefinedLocalesCodes
/**
* {@inheritdoc}
*/
public function getDefinedLocalesCodes()
{
$locales = $this->localeRepository->findAll();
return array_map(function (LocaleInterface $locale) {
return $locale->getCode();
}, $locales);
}
示例3: getLocales
/**
* @return array
*/
private function getLocales()
{
/** @var LocaleInterface[] $locales */
$locales = $this->localeRepository->findAll();
foreach ($locales as $locale) {
(yield $locale->getCode());
}
}
示例4: getLocalesCodes
/**
* @return array
*/
private function getLocalesCodes()
{
$localesCodes = [];
/** @var LocaleInterface $locale */
foreach ($this->localeRepository->findAll() as $locale) {
$localesCodes[$locale->getName()] = $locale->getCode();
}
return $localesCodes;
}
示例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']);
}
示例6: configureOptions
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(['choices' => function (Options $options) {
if (isset($options['subject'])) {
return $this->paymentMethodsResolver->getSupportedMethods($options['subject']);
}
return $this->paymentMethodRepository->findAll();
}, 'choice_value' => 'id', 'choice_label' => 'name', 'choice_translation_domain' => false])->setDefined(['subject'])->setAllowedTypes('subject', PaymentInterface::class);
}
示例7: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$productAssociationTypes = $this->productAssociationTypeRepository->findAll();
/** @var ProductAssociationTypeInterface $productAssociationType */
foreach ($productAssociationTypes as $productAssociationType) {
$builder->add($productAssociationType->getCode(), TextType::class, ['label' => $productAssociationType->getName()]);
}
$builder->addModelTransformer($this->productsToProductAssociationsTransformer);
}
示例8: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$taxonomies = $this->taxonomyRepository->findAll();
$builder->addModelTransformer(new $options['model_transformer']['class']($taxonomies, $options['model_transformer']['save_objects']));
foreach ($taxonomies as $taxonomy) {
/* @var $taxonomy TaxonomyInterface */
$builder->add($taxonomy->getId(), 'choice', array('choice_list' => new ObjectChoiceList($this->taxonRepository->getTaxonsAsList($taxonomy), null, array(), null, 'id'), 'multiple' => $options['multiple'], 'label' => $taxonomy->getName()));
}
}
示例9: configureOptions
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$choiceList = function (Options $options) {
if (null === $options['country']) {
return new ObjectChoiceList($this->repository->findAll(), null, array(), null, 'id');
}
return new ObjectChoiceList($options['country']->getProvinces(), null, array(), null, 'id');
};
$resolver->setDefaults(array('choice_list' => $choiceList, 'country' => null, 'label' => 'sylius.form.address.province', 'empty_value' => 'sylius.form.province.select'));
}
示例10: findCaptureToken
/**
* @return TokenInterface
*
* @throws \RuntimeException
*/
private function findCaptureToken()
{
$tokens = $this->securityTokenRepository->findAll();
foreach ($tokens as $token) {
if (strpos($token->getTargetUrl(), 'capture')) {
return $token;
}
}
throw new \RuntimeException('Cannot find capture token, check if you are after proper checkout steps');
}
示例11: 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']);
}
示例12: 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]);
}
示例13: getAvailableCountries
/**
* Should be private, used public to support PHP 5.3
*
* @internal
*
* @return array
*/
public function getAvailableCountries()
{
$availableCountries = Intl::getRegionBundle()->getCountryNames();
/** @var CountryInterface[] $definedCountries */
$definedCountries = $this->countryRepository->findAll();
foreach ($definedCountries as $country) {
unset($availableCountries[$country->getIsoName()]);
}
return $availableCountries;
}
示例14: getAvailableLocales
/**
* Should be private, used public to support PHP 5.3
*
* @internal
*
* @return array
*/
public function getAvailableLocales()
{
$availableLocales = Intl::getLocaleBundle()->getLocaleNames();
/** @var LocaleInterface[] $definedLocales */
$definedLocales = $this->localeRepository->findAll();
foreach ($definedLocales as $locale) {
unset($availableLocales[$locale->getCode()]);
}
return $availableLocales;
}
示例15: getZoneCodes
/**
* @return array
*/
private function getZoneCodes()
{
$zoneObjects = $this->zoneRepository->findAll();
$zones = [];
/* @var ZoneInterface $zone */
foreach ($zoneObjects as $zone) {
$zones[$zone->getCode()] = $zone->getName();
}
return $zones;
}