On persist user.

@param em        entity manager instance.
@param user      user object.
185644
static void onPersist(final EntityManager em, final User user) 
	{
		logger.info("");
		logger.info("");
		logger.info("#######################Persisting##########################################");
		logger.info("");
		logger.info(user.toString());
		persist(user, em);
		logger.info("");
		System.out.println("#######################Persisting##########################################");
		logger.info("");
		logger.info("");
	}
710903
public function activateUser(User $user)
    {
        $user->setIsEnabled(true);
        $user->setIsMailValidated(true);
        $user->setResetPasswordHash(null);
        $user->setInitDate(new \DateTime());

        $this->objectManager->persist($user);
        $this->objectManager->flush();
    }
1303484
private function updateUsers(EntityManager $em)
    {
        $em->getConnection()->executeUpdate(
            'INSERT INTO Users
            (
                id,                     activity,               address,                admin,
                can_change_ftp_profil,  can_change_profil,      city,                   company,
                country,                email,                  fax,                    first_name,
                geoname_id,             guest,                  job,                    last_connection,
                last_name,              ldap_created,           locale,                 login,
                mail_locked,            last_model,             mail_notifications,     nonce,
                password,               push_list,              request_notifications,  salted_password,
                gender,                 phone,                  timezone,               zip_code,
                created,                updated,                deleted
            )
            (
                SELECT
                usr_id,                 activite,               adresse,                create_db,
                canchgftpprofil,        canchgprofil,           ville,                  societe,
                pays,                   usr_mail,               fax,                    usr_prenom,
                geonameid,              invite,                 fonction,               last_conn,
                usr_nom,                ldap_created,           locale,                 usr_login,
                mail_locked,            NULL AS lastModel,      mail_notifications,     '.($this->hasField($em, 'nonce') ? 'nonce' : 'NULL AS nonce').',
                usr_password,           push_list,              request_notifications,  '.($this->hasField($em, 'salted_password') ? 'salted_password' : '0 AS salted_password').',
                usr_sexe,               tel,                    timezone,               cpostal,
                usr_creationdate,       usr_modificationdate,   0
                FROM usr
            )'
        );

        $em->getConnection()->executeUpdate('UPDATE Users SET geoname_id=NULL WHERE geoname_id=0');
        $em->getConnection()->executeUpdate(
            'UPDATE Users SET locale=NULL WHERE locale NOT IN (:locales)',
            ['locales' => array_keys(Application::getAvailableLanguages())],
            ['locales' => Connection::PARAM_STR_ARRAY]
        );
        $em->getConnection()->executeUpdate('UPDATE Users SET deleted=1, login=SUBSTRING(login, 11) WHERE login LIKE "(#deleted_%"');
    }
1357784
public static List<SuspensionRecord> findByUser(EntityManager em, PrincipalUser user) {
        TypedQuery<SuspensionRecord> query = em.createNamedQuery("SuspensionRecord.findByUser", SuspensionRecord.class);

        try {
            query.setParameter("user", user);
            return query.getResultList();
        } catch (NoResultException ex) {
            return new ArrayList<>(0);
        }
    }
1335957
public void setUser(String user) {
		if(isModifiable == ModifiableRule.NotModifiable) {
			throw new IllegalArgumentException("not allowed to set user part, the URI is not modifiable");
		}
		try {
			getSipURI().setUser(user);			
		} catch (ParseException e) {
			logger.error("error setting parameter ", e);
		}
	}
509692
public function setLocale(User $user, $locale = 'en')
    {
        $user->setLocale($locale);
        $this->objectManager->persist($user);
        $this->objectManager->flush();
    }
658950
public function update(User $user, $flush = true)
    {
        $this->objectManager->persist($user);

        if ($flush) {
            $this->objectManager->flush();
        }
    }
880946
public function saveUser($user)
    {
        if (is_array($user)) {
            $user = new Entity\Users($user);
        }

        // Make sure the username is slug-like
        $user->setUsername($this->app['slugify']->slugify($user->getUsername()));

        // Save the entity
        return $this->getRepository()->save($user);
    }
717300
public function setUser(\Concrete\Core\Entity\User\User $user)
    {
        $this->author = $user;
        $this->save();
    }
286279
public function updateRememberToken(UserInterface $user, $token)
    {
        $user->setRememberToken($token);
        $this->entityManager->persist($user);
        $this->entityManager->flush();
    }
320450
protected function delete(User $user, Model $model)
    {
        if (
            $this->isUsingSoftDeletes($model) &&
            ! $model->trashed() &&
            $user->isDisabled()
        ) {
            // If deleting is enabled, the model supports soft deletes, the model
            // isn't already deleted, and the LDAP user is disabled, we'll
            // go ahead and delete the users model.
            $model->delete();

            if ($this->isLogging()) {
                $type = get_class($user->getSchema());

                logger()->info("Soft-deleted user {$user->getCommonName()}. Their {$type} user account is disabled.");
            }
        }
    }
333136
public void addSharedContextUser(Context sharedContext, User user) {
		this.getContextPanel(sharedContext.getIndex()).getUsersTableModel().addUser(user);
	}
851861
public function setUserData(User $user)
    {
        $userVarArray = get_object_vars($user);

        foreach ($userVarArray as $key => $value) {
            if ($value !== null) {
                $this->{$key} = $value;
            }
        }
    }
1095601
private UserEntity ensureRolesFetched(final UserEntity user)
	{
		if (user != null)
			user.getRoles().stream().map(r -> r.getId()).collect(Collectors.toList());

		return user;
	}
255049
public function updateUser(UserInterface $user)
    {
        $user->setChangedValue();
        $this->em->persist($user);
        $this->em->flush();
        return true;
    }
977054
public void addUserInUserManager(User user) {
        if (!userManager.getUserList().contains(user.getUsername())) {
            try {
                userManager.createUser(user.getUsername());
            } catch (UserExistsException e) {
                LOGGER.warn("User already exists!", e);
                return;
            }
        }
        for (Attribute attribute : user.getAttributes()) {
            userManager.setUserAttribute(user.getUsername(), attribute.getAttributeName(), attribute.getValues()
                    .toArray());
        }
    }
183084
private void updateUser(CmsUser user) {

        setUserPasswordStatus(user, m_forceResetPassword.getValue().booleanValue());
        user.setDescription(m_description.getValue());
        user.setManaged(!m_selfmanagement.getValue().booleanValue());
        user.setEnabled(m_enabled.getValue().booleanValue());
        m_userdata.submit(user, m_cms, new Runnable() {

            public void run() {
                //
            }
        }, true);
    }