5use Bitrix\Calendar\Core;
39 if (!is_null($entity))
52 if ($this->
getCacheMap()->has($entityObject->getId()))
54 return $this->
getCacheMap()->getItem($entityObject->getId());
60 $this->
getCacheMap()->add($entity, $entity->getId());
75 Core\
Base\EntityInterface $entity,
77 ): ?Core\
Base\EntityInterface
85 if ($resultEntity && $resultEntity->getId())
87 $this->
getCacheMap()->add($resultEntity, $resultEntity->getId());
100 Core\
Base\EntityInterface $entity,
102 ): ?Core\
Base\EntityInterface
106 if ($resultEntity && $resultEntity->getId())
108 $this->
getCacheMap()->updateItem($resultEntity, $resultEntity->getId());
110 return $resultEntity;
122 public function delete(
124 array $params = [
'softDelete' =>
true]
125 ): ?Core\
Base\EntityInterface
128 if ($resultEntity ===
null)
135 if (!empty($resultEntity->getId()))
137 $this->
getCacheMap()->updateItem($resultEntity, $resultEntity->getId());
139 return $resultEntity;
155 while ($entity = $map->fetch())
157 $this->
delete($entity, $params);
170 public function deleteByFilter($filter, array $params = [
'softDelete' =>
true]): self
173 $result =
new $className();
180 while ($row = $managerResult->fetchObject())
184 $this->
delete($this->
getCacheMap()->getItem($row->getId()), $params);
189 $entity = $this->
getById($row->getId());
190 $this->
delete($entity, $params);
207 public function getMap($filter,
int $limit =
null, array $order =
null): Core\
Base\
Map
210 $result =
new $className();
211 $params = [
'filter' => $filter];
214 $params[
'limit'] = $limit;
218 $params[
'order'] = $order;
223 while ($row = $managerResult->fetchObject())
228 $result->add($link, $link->getId());
255 if (empty(self::$cache[static::class]))
260 return self::$cache[static::class];
270 $object = (get_class($this) === $class)
274 $mapClassName = $object->getMapClass();
276 self::$cache[$class] =
new $mapClassName();
285 return Core\Base\EntityMap::class;
319 abstract protected function createEntity($entity, array $params = []): ?Core\
Base\EntityInterface;
326 abstract protected function updateEntity($entity, array $params = []): ?Core\
Base\EntityInterface;
333 abstract protected function deleteEntity(Core\
Base\EntityInterface $entity, array $params): ?Core\
Base\EntityInterface;
convertToObject($objectEO)
initCacheMap(string $class)
updateEntity($entity, array $params=[])
getMap($filter, int $limit=null, array $order=null)
deleteMap(Core\Base\EntityMap $map, array $params=['softDelete'=> true])
deleteByFilter($filter, array $params=['softDelete'=> true])
update(Core\Base\EntityInterface $entity, array $params=[])
getOneEntityByFilter(array $filter)
deleteEntity(Core\Base\EntityInterface $entity, array $params)
create(Core\Base\EntityInterface $entity, array $params=[])
getByEntityObject($entityObject)
createEntity($entity, array $params=[])
getDataManagerResult(array $params)