/**
* Cleans the facebbok username.
*
* @param PreUpdateEventArgs $args
*/
public function preUpdate(PreUpdateEventArgs $args)
{
$entity = $args->getEntity();
if ($entity instanceof Plugin && $entity->getNamespace() == 'Elcodi\\Plugin\\TwitterBundle\\ElcodiTwitterBundle') {
$twitterAccount = $entity->getConfiguration()->getFieldValue('twitter_account');
$entity->getConfiguration()->setFieldValue('twitter_account', $this->twitterUsernameCleaner->clean($twitterAccount));
}
}