Elcodi\Plugin\TwitterBundle\EventListener\TwitterUsernameEventListener::preUpdate PHP Method

preUpdate() public method

Cleans the facebbok username.
public preUpdate ( Doctrine\ORM\Event\PreUpdateEventArgs $args )
$args Doctrine\ORM\Event\PreUpdateEventArgs
    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));
        }
    }
TwitterUsernameEventListener