if (!
$presetId) { throw new ParameterMissingException('id'
);
} /** @var Preset|null $preset */
$preset =
$this->models->
find(Preset::
class,
$presetId);
if (!
$preset) { throw new NotFoundException(sprintf('Emotion preset with id %s not found',
$presetId));
} if (!
$preset->
getCustom()) { throw new PrivilegeException(sprintf('Emotion preset %s is not defined as custom preset',
$preset->
getName()));
} $this->models->
remove($preset);
$this->models->
flush($preset);
} /**
* @param string $locale
*
* @throws ParameterMissingException
*
* @return Preset
*/