/** * Copy current role to the given partner. * @param int $partnerId */ public function copyToPartner($partnerId) { $newRole = new UserRole(); $newRole->setName($this->getName()); $newRole->setDescription($this->getDescription()); $newRole->setStatus($this->getStatus()); $newRole->setPermissionNames(parent::getPermissionNames()); $newRole->setCustomData($this->getCustomData()); $newRole->setPartnerId($partnerId); // set new partner id $newRole->setTags($this->getTags()); return $newRole; }