/** * Cleans the facebbok username. * * @param PreUpdateEventArgs $args */ public function preUpdate(PreUpdateEventArgs $args) { $entity = $args->getEntity(); if ($entity instanceof Plugin && $entity->getNamespace() == 'Elcodi\\Plugin\\FacebookBundle\\ElcodiFacebookBundle') { $facebookAccount = $entity->getConfiguration()->getFieldValue('facebook_account'); $entity->getConfiguration()->setFieldValue('facebook_account', $this->facebookUsernameCleaner->clean($facebookAccount)); } }