codeTemplates/src/Entity/Savers/TemplateEntityUpserter.php
public function convertUpsertDtoToEntity(TemplateEntityDto $dto): TemplateEntityInterface
    {
        if ($this->unitOfWorkHelper->hasRecordOfDto($dto) === false) {
            $entity = $this->entityFactory->create($dto);

            return $entity;
        }
        $entity = $this->unitOfWorkHelper->getEntityFromUnitOfWorkUsingDto($dto);
        $entity->update($dto);

        return $entity;
    }
public function convertUpsertDtoToEntity(TemplateEntityDto $dto): TemplateEntityInterface
    {
        if ($this->unitOfWorkHelper->hasRecordOfDto($dto) === false) {
            $entity = $this->entityFactory->create($dto);

            return $entity;
        }
        $entity = $this->unitOfWorkHelper->getEntityFromUnitOfWorkUsingDto($dto);
        $entity->update($dto);

        return $entity;
    }
public function convertUpsertDtoToEntity ( TemplateEntityDto $ dto ) : TemplateEntityInterface { if ( $ this -> unitOfWorkHelper -> hasRecordOfDto ( $ dto ) === false ) { $ entity = $ this -> entityFactory -> create ( $ dto ) ; return $ entity ; } $ entity = $ this -> unitOfWorkHelper -> getEntityFromUnitOfWorkUsingDto ( $ dto ) ; $ entity -> update ( $ dto ) ; return $ entity ; }
This method will convert the DTO into an entity, but will not save it. This is useful if you want to bulk create
or update entities

@param TemplateEntityDto $dto

@return TemplateEntityInterface
This method will convert the DTO into an entity but will not save it . This is useful if you want to bulk create or update entities