Set the Path for newly created DataObjects

Hello, I am trying to set the path for newly created objects by using the setPath function.
The code looks as follows:

$obj = new DataObject\MyCategory;

however after the save() function is called, the path is not saved.
After setPath is called the o_path is set correctly, but after the save function it is again set to /.

Am I doing something wrong?

I don’t think you can set the Path directly. The path gets generated via the parent object:

1 Like

Thank you, it is working now!