Пример #1
0
 /**
  * @param object      $repository
  * @param UserProfile $userProfile
  * @param string      $key
  * @param object|null $entity
  */
 private function setEntity($repository, UserProfile $userProfile, $key, $entity)
 {
     if (!is_object($entity)) {
         if (!($entity = $repository->findOne($entity))) {
             return;
         }
     }
     if (!$this->getCurrentUserProfile()->isNew()) {
         $userProfile->setActivePreference($key . '_id', $entity->getId());
         $this->userProfile->save();
     }
     $this->setPreferenceCookie($key, $entity);
 }