コード例 #1
0
 /**
  * Register the Registration ID (token) obtained from Google Cloud Messaging for a user
  * @param Chamilo\UserBundle\Entity\User $user The user
  * @param string $registrationId The token registration id from Google Cloud Messaging
  * @return int The id after insert or the number of affected rows after update. Otherwhise return false
  */
 public static function setGcmRegistrationId(Chamilo\UserBundle\Entity\User $user, $registrationId)
 {
     $registrationId = Security::remove_XSS($registrationId);
     $extraFieldValue = new ExtraFieldValue('user');
     return $extraFieldValue->save(['variable' => self::EXTRA_FIELD_GCM_REGISTRATION, 'value' => $registrationId, 'item_id' => $user->getId()]);
 }