Skip to content
Snippets Groups Projects
Commit 61cff027 authored by Ron Lucke's avatar Ron Lucke
Browse files

BIEST #2049

Closes #2049

Merge request studip/studip!1328
parent d26ad6c1
No related branches found
No related tags found
No related merge requests found
......@@ -817,6 +817,12 @@ SQL;
*/
public function copy(User $user, StructuralElement $parent, string $purpose = ''): StructuralElement
{
$ancestorIds = array_column($parent->findAncestors(), 'id');
$ancestorIds[] = $parent->id;
if (in_array($this->id, $ancestorIds)) {
throw new \InvalidArgumentException('Cannot copy into descendants.');
}
$file_ref_id = $this->copyImage($user, $parent);
$element = self::build([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment