本文整理汇总了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;
}
示例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());
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例9: addBundle
public function addBundle(BaseBundle $bundle)
{
if (!$this->bundles->containsKey($bundle->name)) {
$bundle->map = $this;
$this->bundles->set($bundle->name, $bundle);
}
return $this;
}
示例10: addModel
public function addModel(BaseModel $model)
{
if (!$this->models->containsKey($model->name)) {
$model->bundle = $this;
$this->models->set($model->name, $model);
}
return $this;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
});
}
示例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;
}