public function prePersist(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if ($this->checkEntityType($entity)) {
            $password = $entity->getPassword();

            if (!empty($password)) {
                $encodedPassword = $this->encryptPassword($password);
                $entity->setPassword($encodedPassword);
            }
        }
    }
public function prePersist(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if ($this->checkEntityType($entity)) {
            $password = $entity->getPassword();

            if (!empty($password)) {
                $encodedPassword = $this->encryptPassword($password);
                $entity->setPassword($encodedPassword);
            }
        }
    }
public function prePersist ( LifecycleEventArgs $ args ) { $ entity = $ args -> getEntity ( ) ; if ( $ this -> checkEntityType ( $ entity ) ) { $ password = $ entity -> getPassword ( ) ; if ( ! empty ( $ password ) ) { $ encodedPassword = $ this -> encryptPassword ( $ password ) ; $ entity -> setPassword ( $ encodedPassword ) ; } } }
New entity. Password must be encrypted always.

@param LifecycleEventArgs $args Event args
New entity . Password must be encrypted always .