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


PHP ArrayCollection::set方法代码示例

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


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

示例1: getContent

 /**
  *
  * Returns an ArrayCollection containing three keys :
  *    - self::BASKETS : an ArrayCollection of the actives baskets
  *     (Non Archived)
  *    - self::STORIES : an ArrayCollection of working stories
  *    - self::VALIDATIONS : the validation people are waiting from me
  *
  * @return \Doctrine\Common\Collections\ArrayCollection
  */
 public function getContent($sort)
 {
     /* @var $repo_baskets Alchemy\Phrasea\Model\Repositories\BasketRepository */
     $repo_baskets = $this->app['repo.baskets'];
     $sort = in_array($sort, ['date', 'name']) ? $sort : 'name';
     $ret = new ArrayCollection();
     $baskets = $repo_baskets->findActiveByUser($this->app['authentication']->getUser(), $sort);
     // force creation of a default basket
     if (0 === count($baskets)) {
         $basket = new BasketEntity();
         $basket->setName($this->app->trans('Default basket'));
         $basket->setUser($this->app['authentication']->getUser());
         $this->app['EM']->persist($basket);
         $this->app['EM']->flush();
         $baskets = [$basket];
     }
     $validations = $repo_baskets->findActiveValidationByUser($this->app['authentication']->getUser(), $sort);
     /* @var $repo_stories Alchemy\Phrasea\Model\Repositories\StoryWZRepository */
     $repo_stories = $this->app['repo.story-wz'];
     $stories = $repo_stories->findByUser($this->app, $this->app['authentication']->getUser(), $sort);
     $ret->set(self::BASKETS, $baskets);
     $ret->set(self::VALIDATIONS, $validations);
     $ret->set(self::STORIES, $stories);
     return $ret;
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:35,代码来源:WorkZone.php

示例2: addToFilters

 public function addToFilters(ArrayCollection $filters)
 {
     $upperBound = $this->fields . '_' . $this->options['upper_bound_suffix'];
     $lowerBound = $this->fields . '_' . $this->options['lower_bound_suffix'];
     $filters->set($lowerBound, $this->getGreaterThanFilter());
     $filters->set($upperBound, $this->getLessThanFilter());
 }
开发者ID:bitecodes,项目名称:doctrine-filter,代码行数:7,代码来源:BetweenFilterType.php

示例3: update

 /**
  * @inheritdoc
  */
 public function update(User $user)
 {
     if (!$this->collection->containsKey((string) $user->getId())) {
         throw new UserNotFoundException();
     }
     $this->collection->set((string) $user->getId(), $user);
 }
开发者ID:xtreamwayz,项目名称:zend-expressive-app-poc,代码行数:10,代码来源:InMemoryUserRepository.php

示例4: addProvider

 /**
  * @param ProviderInterface $provider
  *
  * @return $this
  */
 public function addProvider(ProviderInterface $provider)
 {
     if (!$this->providers->contains($provider)) {
         $this->providers->set($provider->getName(), $provider);
     }
     return $this;
 }
开发者ID:oktapodia,项目名称:ss-test,代码行数:12,代码来源:ProviderContainer.php

示例5: addAction

 /**
  * @param string $type
  * @param array $options
  * @return $this
  */
 protected function addAction($type, array $options = [])
 {
     $action = $this->actionFactory->get($type, $options);
     $suffix = $action->getOptions()['route_suffix'];
     $key = empty($suffix) ? $action->getName() : $suffix;
     $this->actions->set($key, $action);
     return $this;
 }
开发者ID:auamarto,项目名称:crud-bundle,代码行数:13,代码来源:ActionsProvider.php

示例6: addAction

 /**
  * @param string $type
  * @param array $options
  * @return ActionsProvider
  */
 protected function addAction(string $type, array $options = []) : self
 {
     $action = $this->actionFactory->get($type, $options);
     $suffix = $action->getOptions()['route_suffix'];
     $key = empty($suffix) ? str_replace('Action', '', substr($type, strrpos($type, '\\') + 1)) : $suffix;
     $this->actions->set(strtolower($key), $action);
     return $this;
 }
开发者ID:vardius,项目名称:crud-bundle,代码行数:13,代码来源:ActionsProvider.php

示例7: add

 public function add(IEntity $entity)
 {
     $this->errorOnInvalidEntityType($entity);
     if ($this->getIdentityValue($entity) < 1) {
         $this->setIdentityValue($entity, $this->collection->count() + 1);
     }
     $this->collection->set($entity->getId(), $entity);
 }
开发者ID:nebuchar,项目名称:ddd-blog,代码行数:8,代码来源:FakeRepository.php

示例8: build

 public function build(\SimplePie_Item $feed)
 {
     $data = new ArrayCollection();
     $data->set('title', $feed->get_title());
     $data->set('url', $feed->get_permalink());
     $data->set('description', $feed->get_description());
     return $data;
 }
开发者ID:ffff5912,项目名称:antena,代码行数:8,代码来源:FeedService.php

示例9: addBundle

 public function addBundle(BaseBundle $bundle)
 {
     if (!$this->bundles->containsKey($bundle->name)) {
         $bundle->map = $this;
         $this->bundles->set($bundle->name, $bundle);
     }
     return $this;
 }
开发者ID:mattcrowe,项目名称:ginny,代码行数:8,代码来源:BaseMap.php

示例10: addModel

 public function addModel(BaseModel $model)
 {
     if (!$this->models->containsKey($model->name)) {
         $model->bundle = $this;
         $this->models->set($model->name, $model);
     }
     return $this;
 }
开发者ID:mattcrowe,项目名称:ginny,代码行数:8,代码来源:BaseBundle.php

示例11: setDefaultConfig

 public function setDefaultConfig($key, $value, $type, $section = "default")
 {
     $valueArray = new \Doctrine\Common\Collections\ArrayCollection();
     $valueArray->set('value', $value);
     $valueArray->set('section', $section);
     $valueArray->set('key', $key);
     $valueArray->set('type', $type);
     $this->configList->set($section . '.' . $key, $valueArray);
 }
开发者ID:symbb,项目名称:symbb,代码行数:9,代码来源:ConfigDefaultsEvent.php

示例12: add

 /**
  * @param Car $car
  * @return boolean
  */
 public function add(Car $car)
 {
     if ($this->has($car)) {
         return false;
     }
     $this->cars->set($car->getId(), 1);
     $this->session->set('cart', $this->cars);
     return true;
 }
开发者ID:s181150,项目名称:my_project_name,代码行数:13,代码来源:Cart.php

示例13: addActivity

 /**
  * Add activity
  *
  * @param Activity $activity
  * @return Student
  */
 public function addActivity(Activity $activity)
 {
     $key = $activity->getMachineName();
     if ($this->activities->containsKey($key)) {
         throw new \InvalidArgumentException('This Student already belongs to this Activity');
     }
     $this->activities->set($key, $activity);
     return $this;
 }
开发者ID:AlexEvesDeveloper,项目名称:teachers.beta,代码行数:15,代码来源:Student.php

示例14: __construct

 /**
  * Constructor
  *
  * @param string $text
  * @param WordFactory $wordFactory
  */
 public function __construct($text, WordFactory $wordFactory)
 {
     $this->text = $text;
     $this->words = new ArrayCollection(explode(' ', $text));
     $this->words->forAll(function ($index, $word) use($wordFactory) {
         $this->words->set($index, $wordFactory->make($word));
         return true;
     });
 }
开发者ID:epfremmer,项目名称:PHP-Weekly-Issue28,代码行数:15,代码来源:Sentence.php

示例15: addChannelType

 /**
  * Set registered types
  *
  * @param string               $typeName
  * @param IntegrationInterface $type
  *
  * @throws \LogicException
  * @return $this
  */
 public function addChannelType($typeName, IntegrationInterface $type)
 {
     if (!$this->integrationTypes->containsKey($typeName)) {
         $this->integrationTypes->set($typeName, $type);
     } else {
         throw new LogicException(sprintf('Trying to redeclare integration type "%s".', $typeName));
     }
     return $this;
 }
开发者ID:Maksold,项目名称:platform,代码行数:18,代码来源:TypesRegistry.php


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