Example #1
0
 public function updateUser(DBUser $userdb, APIUser $userAPI)
 {
     if (!empty($userAPI->getUsername())) {
         $userdb->setUsername($userAPI->getUsername());
     }
     if (!empty($userAPI->getEmail())) {
         $userdb->setEmail($userAPI->getEmail());
     }
     foreach ($userdb->getUserproperties() as $dbProp) {
         foreach ($userAPI->getProperties() as $userProp) {
             if ($dbProp->getId() == $userProp->getId()) {
                 $dbProp->setValue($userProp->getValue());
             }
         }
     }
     $this->em->persist($userdb);
     $this->em->flush();
     return $this->getSingleUser($userdb->getId());
 }