4848use Pimcore \Bundle \StudioBackendBundle \Util \Constant \ElementPermissions ;
4949use Pimcore \Bundle \StudioBackendBundle \Util \Constant \ElementTypes ;
5050use Pimcore \Bundle \StudioBackendBundle \Util \Constant \HttpResponseCodes ;
51- use Pimcore \Bundle \StudioBackendBundle \Util \Constant \HttpResponseErrorKeys ;
5251use Pimcore \Bundle \StudioBackendBundle \Util \Trait \ElementProviderTrait ;
5352use Pimcore \Bundle \StudioBackendBundle \Util \Trait \UserPermissionTrait ;
5453use Pimcore \Model \DataObject \AbstractObject ;
@@ -91,13 +90,6 @@ public function __construct(
9190 ) {
9291 }
9392
94- public function getDataObjectFullPath (
95- string $ parentFullPath ,
96- string $ key
97- ): string {
98- return str_ends_with ($ parentFullPath , '/ ' ) === true ? $ parentFullPath . $ key : $ parentFullPath . '/ ' . $ key ;
99- }
100-
10193 /**
10294 * @throws DatabaseException
10395 * @throws ElementSavingFailedException
@@ -112,15 +104,9 @@ public function addDataObject(
112104 ): int {
113105 $ user = $ this ->securityService ->getCurrentUser ();
114106 $ parent = $ this ->getValidParent ($ user , $ parentId );
115- $ fullPath = $ this ->getDataObjectFullPath (
116- $ parent ->getFullPath (),
117- $ parameters ->getKey ()
118- );
107+ $ fullPath = $ this ->getElementFullPath ($ parent ->getFullPath (), $ parameters ->getKey ());
119108 if ($ this ->dataObjectServiceResolver ->pathExists ($ fullPath )) {
120- throw new ElementExistsException (
121- $ fullPath ,
122- HttpResponseErrorKeys::ELEMENT_EXISTS ->value
123- );
109+ throw new ElementExistsException (error: $ fullPath );
124110 }
125111
126112 $ class = $ this ->getValidClass ($ this ->classDefinitionResolver , $ parameters ->getClassId ());
0 commit comments