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


PHP Collection::get方法代码示例

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


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

示例1: getEntityAttribute

 /**
  * Get related entity attribute
  *
  * @return Attribute
  * @throws UnknownAttributeException
  */
 public function getEntityAttribute()
 {
     if (!$this->attributes->containsKey($this->entityAttributeName)) {
         throw new UnknownAttributeException('There is no entity attribute');
     }
     return $this->attributes->get($this->entityAttributeName);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:13,代码来源:AttributeManager.php

示例2: let

 function let(LoaderInterface $loader, Collection $resourcesToThemes, ThemeInterface $theme)
 {
     $theme->getLogicalName()->willReturn("sylius/sample-theme");
     $resourcesToThemes->get(realpath($this->getThemeTranslationResourcePath()))->willReturn($theme);
     $resourcesToThemes->get(realpath($this->getVanillaTranslationResourcePath()))->willReturn(null);
     $this->beConstructedWith($loader, $resourcesToThemes);
 }
开发者ID:liverbool,项目名称:dos-theme-bundle,代码行数:7,代码来源:LoaderSpec.php

示例3: getCalculator

 private function getCalculator(ShippingMethodInterface $shippingMethod) : ShippingCalculatorInterface
 {
     $calculator = $shippingMethod->getCalculator();
     if (false === $this->calculators->containsKey($calculator)) {
         throw new CalculatorNotFoundException($calculator);
     }
     return $this->calculators->get($calculator);
 }
开发者ID:WellCommerce,项目名称:ShippingBundle,代码行数:8,代码来源:ShippingMethodProvider.php

示例4: addProduct

 /**
  * @param Product $product
  * @param Quantity $quantity
  * @return Cart
  */
 public function addProduct(Product $product, Quantity $quantity) : Cart
 {
     $key = $product->getId()->getValue();
     /** @var LineItem $lineItem */
     $lineItem = $this->lineItems->get($key);
     if ($lineItem === null) {
         $lineItem = new LineItem($product, $quantity);
     } else {
         $lineItem = new LineItem($product, $lineItem->getQuantity()->add($quantity));
     }
     $this->lineItems->set($key, $lineItem);
     return $this;
 }
开发者ID:igaponov,项目名称:shop,代码行数:18,代码来源:Cart.php

示例5: load

 /**
  * {@inheritdoc}
  */
 public function load($resource, $locale, $domain = 'messages')
 {
     $messageCatalogue = $this->loader->load($resource, $locale, $domain);
     if (null !== ($theme = $this->resourcesToThemes->get(realpath($resource)))) {
         $messages = $messageCatalogue->all($domain);
         foreach ($messages as $key => $value) {
             unset($messages[$key]);
             $messages[$key . '|' . $theme->getLogicalName()] = $value;
         }
         $messageCatalogue->replace($messages, $domain);
     }
     return $messageCatalogue;
 }
开发者ID:liverbool,项目名称:dos-theme-bundle,代码行数:16,代码来源:Loader.php

示例6: getTranslation

 /**
  * @param bool $allowCreate
  *
  * @return TranslationInterface
  */
 public function getTranslation($allowCreate = false)
 {
     $locales = $this->getLocales();
     if (empty($locales)) {
         throw new LocaleNotFoundException();
     }
     $translation = null;
     foreach ($locales as $locale) {
         if (($translation = $this->translations->get($locale)) !== null) {
             break;
         }
     }
     if ($translation === null && $allowCreate) {
         $translation = $this->getTranslationFactory()->create(['locale' => reset($locales)]);
         $this->addTranslation($translation);
     }
     if ($translation === null && $this->hasFallbackLocale()) {
         $translation = $this->translations->get($this->getFallbackLocale());
     }
     if ($translation === null) {
         if ($this->hasFallbackLocale()) {
             $locales[] = $this->getFallbackLocale();
         }
         throw new TranslationNotFoundException();
     }
     return $translation;
 }
开发者ID:php-lug,项目名称:lug,代码行数:32,代码来源:TranslatableTrait.php

示例7: getType

 public function getType(string $type) : TypeInterface
 {
     if (false === $this->types->containsKey($type)) {
         throw new TypeNotFoundException($type, $this->types->getKeys());
     }
     return $this->types->get($type);
 }
开发者ID:WellCommerce,项目名称:SearchBundle,代码行数:7,代码来源:SearchManager.php

示例8: createNewContainer

 /**
  * @param int $index
  * @return \Kdyby\Doctrine\Forms\EntityContainer
  */
 private function createNewContainer($index)
 {
     if (!$this->collection->containsKey($index)) {
         $this->collection->set($index, $this->createNewEntity());
     }
     $class = $this->containerClass;
     return new $class($this->collection->get($index));
 }
开发者ID:svobodni,项目名称:web,代码行数:12,代码来源:CollectionContainer.php

示例9: allows

 /**
  * Check if the given permission is allowed.
  * Only explicitly allowed permissions will return true.
  *
  * @param string $permissionName
  * @return bool
  */
 protected function allows($permissionName)
 {
     foreach ($this->getMatchingPermissions($permissionName) as $key) {
         /** @var Permission $permission */
         $permission = $this->permissions->get($key);
         if ($permission->isAllowed()) {
             return true;
         }
     }
     return false;
 }
开发者ID:digbang,项目名称:security,代码行数:18,代码来源:LazyPermissionsTrait.php

示例10: resolveDependencies

 /**
  * @param Package $package
  * @param array   $packageInfo
  */
 private function resolveDependencies(Package $package, array $packageInfo)
 {
     if (!isset($packageInfo[self::DEPENDENCIES_KEY])) {
         return;
     }
     foreach ($packageInfo[self::DEPENDENCIES_KEY] as $dependencyName => $dependencyInfo) {
         $dependencyPackage = $this->packages->get($dependencyName);
         if (null !== $dependencyPackage) {
             $package->addDependency($dependencyPackage);
         }
     }
 }
开发者ID:boskee,项目名称:SpBowerBundle,代码行数:16,代码来源:DependencyMapper.php

示例11: createPackageFormulae

 /**
  * Creates formulae for the given package.
  *
  * @param \Sp\BowerBundle\Bower\Package\Package $package
  * @param string                                $packageName
  * @param string                                $extension
  *
  * @return array<string,array<array>>
  */
 protected function createPackageFormulae(Package $package, $packageName, $extension)
 {
     /** @var PackageResource $packageResource */
     $packageResource = $this->packageResources->get($packageName);
     $nestDependencies = $this->shouldNestDependencies();
     if (null !== $packageResource && null !== $packageResource->shouldNestDependencies()) {
         $nestDependencies = $packageResource->shouldNestDependencies();
     }
     if (null !== ($assets = $this->createSingleFormula($package, $nestDependencies, $extension))) {
         return array($assets, $this->resolveFilters($extension, $packageResource), array());
     }
     return array();
 }
开发者ID:boskee,项目名称:SpBowerBundle,代码行数:22,代码来源:BowerResource.php

示例12: getStep

 /**
  * Get step by name
  *
  * @param string $stepName
  * @return Step
  */
 public function getStep($stepName)
 {
     return $this->steps->get($stepName);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:10,代码来源:StepManager.php

示例13: getCellByCoordinate

 /**
  * @param string $coordinate
  *
  * @return Cell|null
  */
 public function getCellByCoordinate(string $coordinate)
 {
     return $this->cells->get($coordinate);
 }
开发者ID:eugene-matvejev,项目名称:battleship-game-api,代码行数:9,代码来源:Battlefield.php

示例14: getCelestialBody

 public function getCelestialBody($number)
 {
     return $this->celestialBodies->get($number);
 }
开发者ID:iw-reload,项目名称:iw,代码行数:4,代码来源:System.php

示例15: getSetting

 /**
  * {@inheritdoc}
  */
 public function getSetting($key)
 {
     return $this->settings->get($key);
 }
开发者ID:sulu,项目名称:sulu,代码行数:7,代码来源:Role.php


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