/**
  * Creates or updates a value for a specific key.
  * 
  * (non-PHPdoc)
  * @see PartKeepr\Service.RestfulService::create()
  */
 public function create()
 {
     $userPreference = UserPreference::setPreference($this->getUser(), $this->getParameter("key"), $this->getParameter("value"));
     return array("data" => $userPreference->serialize());
 }
Пример #2
0
 /**
  * Makes sure that an exception is thrown when attempting to set a preference if the user is not persistant yet.
  *
  * @expectedException PartKeepr\Util\Exceptions\EntityNotPersistantException
  */
 public function testSetNonPersistantUserPreference()
 {
     $user = new User();
     UserPreference::setPreference($user, "test", "foo");
 }
Пример #3
0
 /**
  * Sets a user preference
  * 
  * @param string $preferenceKey 	The preference key
  * @param string $preferenceValue 	The preference value
  * @throws EntityNotPersistantException		Thrown if the entity is not persistant
  */
 public function setPreference($preferenceKey, $preferenceValue)
 {
     return UserPreference::setPreference($this, $preferenceKey, $preferenceValue);
 }