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


PHP ArrayCollection::clear方法代码示例

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


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

示例1: clearCollections

 public function clearCollections()
 {
     $this->hookedObjectCollections->forAll(function ($key, HookedObjectCollectionEntity $hookedObjectCollectionEntity) {
         $hookedObjectCollectionEntity->getCollection()->getHookedObjectCollections()->removeElement($hookedObjectCollectionEntity);
         $hookedObjectCollectionEntity->setCollection(null)->setHookedObject(null);
     });
     $this->hookedObjectCollections->clear();
 }
开发者ID:shefik,项目名称:MediaModule,代码行数:8,代码来源:HookedObjectEntity.php

示例2: processing

 /**
  * @param array $collection
  * @param MapInterface $map
  * @param ObjectFactoryInterface|string $factory
  * @param null $aggregator
  * @throws \InvalidArgumentException
  */
 public function processing(array $collection, MapInterface $map, $factory, $aggregator = null)
 {
     $this->aggregator = $aggregator;
     $this->collection = new ArrayCollection($collection);
     $this->map = $map;
     // Checking type of factory and then set as internal tool
     if (is_string($factory)) {
         $this->factory = $this->container->get($factory);
     } else {
         $this->factory = $factory;
     }
     if (count($collection) == 0) {
         throw new \InvalidArgumentException('Collection can\'t be null');
     }
     // Split collection to "new" and "exists"
     $this->ranking();
     // If collection "exists" not empty, then load items form database
     if (!$this->exists->isEmpty()) {
         $this->loadExistsObjects();
     }
     // If collection "new" not empty, then create new entities
     if (!$this->new->isEmpty()) {
         $this->createNewObjects();
     }
     // Clean internal "common" collection
     $this->collection->clear();
     // Clean aggregator
     $this->aggregator = null;
 }
开发者ID:Exanrus,项目名称:crm-bundle,代码行数:36,代码来源:ReverseCollectionTransformer.php

示例3: setItems

 /**
  * Set items
  *
  * @param Iterable $items
  *
  * @return Category
  */
 public function setItems($items)
 {
     $this->items->clear();
     foreach ($items as $item) {
         $this->addItem($item);
     }
     return $this;
 }
开发者ID:jadeit,项目名称:catalogd-bundle,代码行数:15,代码来源:Category.php

示例4: setValues

 /**
  * @param ConfigModelValue[] $values
  * @return $this
  */
 public function setValues($values)
 {
     $this->values->clear();
     foreach ($values as $value) {
         $this->addValue($value);
     }
     return $this;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:12,代码来源:AbstractConfigModel.php

示例5: setParameters

 /**
  * Set parameters.
  *
  * @param array $parameters
  *
  * @return $this
  */
 public function setParameters($parameters)
 {
     if ($this->parameters instanceof ArrayCollection) {
         $this->parameters->clear();
     } else {
         $this->initializeParameters();
     }
     foreach ($parameters as $parameter => $value) {
         $this->setParameter(trim($parameter), $value);
     }
     return $this;
 }
开发者ID:juliangut,项目名称:tify,代码行数:19,代码来源:ParameterTrait.php

示例6: clear

 public function clear()
 {
     if (null === $this->entries) {
         $this->__load___();
     }
     $this->entries->clear();
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:7,代码来源:AggregateEntryCollection.php

示例7: postFlush

 /**
  * Restore all flushed entities to their decrypted state
  * 
  * @param PostFlushEventArgs $eventArgs
  */
 public function postFlush(PostFlushEventArgs $eventArgs)
 {
     foreach ($this->flushedEntities as $entity) {
         $this->decryptEntity($entity);
     }
     $this->flushedEntities->clear();
 }
开发者ID:VincentChalnot,项目名称:SidusEncryptionBundle,代码行数:12,代码来源:CryptableSubscriber.php

示例8: setPayloadData

 /**
  * Set payload data.
  *
  * @param array $data
  *
  * @throws \InvalidArgumentException
  *
  * @return $this
  */
 public function setPayloadData(array $data)
 {
     $this->payload->clear();
     foreach ($data as $key => $value) {
         $this->setPayload($key, $value);
     }
     return $this;
 }
开发者ID:juliangut,项目名称:tify,代码行数:17,代码来源:Message.php

示例9: setTags

 /**
  * Set tags
  *
  * @param Iterable $tags
  *
  * @return Item
  */
 public function setTags($tags)
 {
     $this->tags->clear();
     foreach ($tags as $tag) {
         $this->addTag($tag);
     }
     return $this;
 }
开发者ID:jadeit,项目名称:catalogd-bundle,代码行数:15,代码来源:Item.php

示例10: setSubFolders

 /**
  * @param ArrayCollection|array $folders
  *
  * @return $this
  */
 public function setSubFolders($folders)
 {
     $this->subFolders->clear();
     foreach ($folders as $folder) {
         $this->addSubFolder($folder);
     }
     return $this;
 }
开发者ID:northdakota,项目名称:platform,代码行数:13,代码来源:EmailFolder.php

示例11: setOptions

 /**
  * @param \Shopware\Models\Property\Option[] $options
  * @return Group
  */
 public function setOptions(array $options)
 {
     $this->options->clear();
     foreach ($options as $option) {
         $this->addOption($option);
     }
     return $this;
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:12,代码来源:Group.php

示例12: resetAddresses

 /**
  * Set addresses.
  *
  * This method could not be named setAddresses because of bug CRM-253.
  *
  * @param ArrayCollection|AbstractAddress[] $addresses
  *
  * @return $this
  */
 public function resetAddresses($addresses)
 {
     $this->addresses->clear();
     foreach ($addresses as $address) {
         $this->addAddress($address);
     }
     return $this;
 }
开发者ID:xamin123,项目名称:platform,代码行数:17,代码来源:BaseOrder.php

示例13: clearProducts

 /**
  * Clear all Products
  *
  * @return Sale
  */
 public function clearProducts()
 {
     foreach ($this->products as $product) {
         $this->removeProductWithSale($product);
     }
     $this->products->clear();
     return $this;
 }
开发者ID:tnqsoft,项目名称:admin-bundle,代码行数:13,代码来源:Sale.php

示例14: setKeywords

 /**
  * @param $keywords
  */
 public function setKeywords(array $keywords)
 {
     $this->keywords->clear();
     foreach ($keywords as $keyword) {
         if ($keyword instanceof FileKeyword) {
             $this->keywords->add($keyword);
         }
     }
 }
开发者ID:bedi,项目名称:mfcc-admin-module,代码行数:12,代码来源:File.php

示例15: setTypesAsArray

 /**
  * @param array $types
  */
 public function setTypesAsArray($types)
 {
     $this->types->clear();
     foreach ($types as $type) {
         if ($type) {
             $this->types[] = new TypeEntity($type, $this);
         }
     }
 }
开发者ID:venne,项目名称:catalog-module,代码行数:12,代码来源:AbstractItemEntity.php


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