3namespace Bitrix\Catalog\v2;
5use Bitrix\Main\InvalidOperationException;
27 private $iteratorCallback;
29 private $loaded =
false;
31 private $parentChanged =
false;
40 if ($this->parent !==
null && $this->parent !== $parent)
42 $this->parentChanged =
true;
45 $this->parent = $parent;
63 $this->setItem($item);
70 if ($item->getParentCollection() !== $this)
75 $item->setParentCollection(
null);
76 $this->unsetItem($item);
82 private function setItem(
BaseEntity $item): self
85 $this->items[$item->
getHash()] = $item;
86 unset($this->removedItems[$item->
getHash()]);
91 private function unsetItem(BaseEntity $item): self
93 unset($this->items[$item->getHash()]);
94 $this->removedItems[$item->getHash()] = $item;
108 unset($this->removedItems[$item->getHash()]);
120 foreach ($this->items as $item)
122 $item->clearChangedFields();
132 return empty($this->items);
137 if ($this->parentChanged)
142 if (!empty($this->removedItems))
147 foreach ($this->items as
$entity)
162 if ($item->getId() === $id)
173 if ((empty($this->items) || $callback) && !$this->
isLoaded())
182 if ($callback($item))
190 return reset($this->items) ?:
null;
201 foreach ($this->items as
$entity)
246 return new \ArrayIterator(array_values($this->removedItems));
257 return new \ArrayIterator(array_values($this->items));
262 if ($this->iteratorCallback && !$this->
isLoaded())
267 $this->loaded =
true;
275 return $this->loaded;
303 if ($this->iteratorCallback !==
null)
308 $this->iteratorCallback = $iteratorCallback;
323 foreach ($this->items as $item)
325 $res = $item->saveInternal();
327 if (!
$res->isSuccess())
335 $res = $item->deleteInternal();
337 if (
$res->isSuccess())
360 $items = array_merge($this->items, $this->removedItems);
364 $res = $item->deleteInternal();
366 if (!
$res->isSuccess())
addInternal(BaseEntity $item)
clearRemoved(BaseEntity ... $items)
add(BaseEntity ... $items)
setIteratorCallback(\Closure $iteratorCallback)
setParent(?BaseEntity $parent)
getFirst(callable $callback=null)
setParentCollection(?BaseCollection $collection)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']