30 $handlerResult->addError(
new Error(
'Unexpected command type'));
32 return $handlerResult;
35 $ownerId = $command->getOwnerId();
38 return $handlerResult;
41 $beforeOwnerId = $entityBefore->getOwnerId();
42 if ($beforeOwnerId === $ownerId)
44 return $handlerResult;
47 $result = CSocNetUserToGroup::SetOwner($ownerId, $command->getId(), [],
true);
51 $handlerResult->addApplicationError();
58 $oldOwnerChangeRoleLogResult =
59 $this->writeMemberRoleUpdateLog(
60 [$entityBefore->getOwnerId()],
62 $command->getInitiatorId(),
67 $newOwnerChangeRoleLogResult =
68 $this->writeMemberRoleUpdateLog(
69 [$command->getOwnerId()],
71 $command->getInitiatorId(),
77 ->merge($oldOwnerChangeRoleLogResult)
78 ->merge($newOwnerChangeRoleLogResult)
81 CollabAnalytics::getInstance()->onOwnerChanged($command->getInitiatorId(), $command->getId());
83 return $handlerResult;