public static function hydrate(stdClass $user)
    {
        $hydrated = new UserEntity();

        if (isset($user->id)) {
            $hydrated->setId($user->id);
        }

        if (isset($user->email)) {
            $hydrated->setEmail($user->email);
        }

        if (isset($user->firstname)) {
            $hydrated->setFirstname($user->firstname);
        }

        if (isset($user->lastname)) {
            $hydrated->setLastname($user->lastname);
        }

        if (isset($user->valid_until)) {
            $hydrated->setValidUntil(new DateTime($user->valid_until));
        }

        if (isset($user->organization)) {
            $hydrated->setOrganization(OrgHydrator::hydrate($user->organization));
        }

        if (isset($user->roles)) {
            $hydrated->setRoles($user->roles);
        }

        if (isset($user->root)) {
            $hydrated->setRoot($user->root);
        }

        if (isset($user->whitelisted_ips)) {
            $hydrated->setWhitelistedIps($user->whitelisted_ips);
        }

        if (isset($user->last_login)) {
            $hydrated->setLastLogin(new DateTime($user->last_login));
        }

        if (isset($user->confirmation_token)) {
            $hydrated->setConfirmationToken($user->confirmation_token);
        }

        if (isset($user->reset_token)) {
            $hydrated->setResetToken($user->reset_token);
        }

        return $hydrated;
    }
public static function hydrate(stdClass $user)
    {
        $hydrated = new UserEntity();

        if (isset($user->id)) {
            $hydrated->setId($user->id);
        }

        if (isset($user->email)) {
            $hydrated->setEmail($user->email);
        }

        if (isset($user->firstname)) {
            $hydrated->setFirstname($user->firstname);
        }

        if (isset($user->lastname)) {
            $hydrated->setLastname($user->lastname);
        }

        if (isset($user->valid_until)) {
            $hydrated->setValidUntil(new DateTime($user->valid_until));
        }

        if (isset($user->organization)) {
            $hydrated->setOrganization(OrgHydrator::hydrate($user->organization));
        }

        if (isset($user->roles)) {
            $hydrated->setRoles($user->roles);
        }

        if (isset($user->root)) {
            $hydrated->setRoot($user->root);
        }

        if (isset($user->whitelisted_ips)) {
            $hydrated->setWhitelistedIps($user->whitelisted_ips);
        }

        if (isset($user->last_login)) {
            $hydrated->setLastLogin(new DateTime($user->last_login));
        }

        if (isset($user->confirmation_token)) {
            $hydrated->setConfirmationToken($user->confirmation_token);
        }

        if (isset($user->reset_token)) {
            $hydrated->setResetToken($user->reset_token);
        }

        return $hydrated;
    }
public static function hydrate ( stdClass $ user ) { $ hydrated = new UserEntity ( ) ; if ( isset ( $ user -> id ) ) { $ hydrated -> setId ( $ user -> id ) ; } if ( isset ( $ user -> email ) ) { $ hydrated -> setEmail ( $ user -> email ) ; } if ( isset ( $ user -> firstname ) ) { $ hydrated -> setFirstname ( $ user -> firstname ) ; } if ( isset ( $ user -> lastname ) ) { $ hydrated -> setLastname ( $ user -> lastname ) ; } if ( isset ( $ user -> valid_until ) ) { $ hydrated -> setValidUntil ( new DateTime ( $ user -> valid_until ) ) ; } if ( isset ( $ user -> organization ) ) { $ hydrated -> setOrganization ( OrgHydrator :: hydrate ( $ user -> organization ) ) ; } if ( isset ( $ user -> roles ) ) { $ hydrated -> setRoles ( $ user -> roles ) ; } if ( isset ( $ user -> root ) ) { $ hydrated -> setRoot ( $ user -> root ) ; } if ( isset ( $ user -> whitelisted_ips ) ) { $ hydrated -> setWhitelistedIps ( $ user -> whitelisted_ips ) ; } if ( isset ( $ user -> last_login ) ) { $ hydrated -> setLastLogin ( new DateTime ( $ user -> last_login ) ) ; } if ( isset ( $ user -> confirmation_token ) ) { $ hydrated -> setConfirmationToken ( $ user -> confirmation_token ) ; } if ( isset ( $ user -> reset_token ) ) { $ hydrated -> setResetToken ( $ user -> reset_token ) ; } return $ hydrated ; }
Hydrate a user object into a UserEntity object

@param stdClass $user
@return UserEntity
Hydrate a user object into a UserEntity object