コード例 #1
0
 /**
  * @see PersistableInterface
  *
  * @return array
  */
 public function preparePersistChangeSet()
 {
     $changeSet = array('username' => $this->username, 'password' => $this->password);
     if ($this->profile !== null) {
         $changeSet['profileId'] = $this->profile->getId();
     }
     if ($this->groups) {
         $groupIds = $this->groups->map(function (Group $group) {
             return $group->getId();
         })->toArray();
         $changeSet['groupIds'] = implode(',', $groupIds);
     }
     if ($this->id !== null) {
         $changeSet['_id'] = (int) $this->id;
     }
     return $changeSet;
 }