Skip to content

Commit 9acbf32

Browse files
authored
Use save service (#904)
1 parent a1762cb commit 9acbf32

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/DataObject/Service/DataObjectService.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use Pimcore\Bundle\StudioBackendBundle\DataObject\Schema\DataObjectAddParameters;
3131
use Pimcore\Bundle\StudioBackendBundle\DataObject\Schema\Type\DataObjectFolder;
3232
use Pimcore\Bundle\StudioBackendBundle\DataObject\Util\Trait\ValidateObjectDataTrait;
33+
use Pimcore\Bundle\StudioBackendBundle\Element\Service\ElementSaveServiceInterface;
3334
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\DatabaseException;
3435
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ElementSavingFailedException;
3536
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ForbiddenException;
@@ -84,6 +85,7 @@ public function __construct(
8485
private EventDispatcherInterface $eventDispatcher,
8586
private SecurityServiceInterface $securityService,
8687
private ServiceResolverInterface $serviceResolver,
88+
private ElementSaveServiceInterface $elementSaveService
8789
) {
8890
}
8991

@@ -319,9 +321,9 @@ private function createNewObject(
319321
$object->setType($parameters->getType());
320322
$object->setCreationDate(time());
321323
$object->setUserOwner($user->getId());
322-
$object->setUserModification($user->getId());
323324
$object->setPublished(false);
324-
$object->save();
325+
326+
$this->elementSaveService->save($object, $user, null);
325327

326328
return $object->getId();
327329
} catch (Exception $exception) {

0 commit comments

Comments
 (0)