本文整理汇总了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();
}
示例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;
}
示例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;
}
示例4: setValues
/**
* @param ConfigModelValue[] $values
* @return $this
*/
public function setValues($values)
{
$this->values->clear();
foreach ($values as $value) {
$this->addValue($value);
}
return $this;
}
示例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;
}
示例6: clear
public function clear()
{
if (null === $this->entries) {
$this->__load___();
}
$this->entries->clear();
}
示例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();
}
示例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;
}
示例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;
}
示例10: setSubFolders
/**
* @param ArrayCollection|array $folders
*
* @return $this
*/
public function setSubFolders($folders)
{
$this->subFolders->clear();
foreach ($folders as $folder) {
$this->addSubFolder($folder);
}
return $this;
}
示例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;
}
示例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;
}
示例13: clearProducts
/**
* Clear all Products
*
* @return Sale
*/
public function clearProducts()
{
foreach ($this->products as $product) {
$this->removeProductWithSale($product);
}
$this->products->clear();
return $this;
}
示例14: setKeywords
/**
* @param $keywords
*/
public function setKeywords(array $keywords)
{
$this->keywords->clear();
foreach ($keywords as $keyword) {
if ($keyword instanceof FileKeyword) {
$this->keywords->add($keyword);
}
}
}
示例15: setTypesAsArray
/**
* @param array $types
*/
public function setTypesAsArray($types)
{
$this->types->clear();
foreach ($types as $type) {
if ($type) {
$this->types[] = new TypeEntity($type, $this);
}
}
}