Beispiel #1
0
 /**
  * Picks the profile with given uniqueness.
  *
  * @param string $uniqueness
  *
  * @return Profile
  */
 public function pick($uniqueness)
 {
     $assignedCards = $this->connectToAssignedCardStorageInternalWorker->connect()->find(['uniqueness' => $uniqueness])->fields(['_id' => 0]);
     $cards = [];
     foreach ($assignedCards as $assignedCard) {
         $cards[] = $this->pickCardInternalWorker->pick($assignedCard['card']);
     }
     return ['uniqueness' => $uniqueness, 'cards' => $cards];
 }
 /**
  * Assigns given cards to the given uniqueness.
  *
  * @param string   $uniqueness
  * @param string[] $cards
  */
 public function assign($uniqueness, $cards)
 {
     foreach ($cards as $i => $card) {
         $this->connectToStorageInternalWorker->connect()->insert(['uniqueness' => $uniqueness, 'card' => $card]);
     }
 }
 /**
  * Deletes the profile with given uniqueness.
  *
  * @param string $uniqueness
  */
 public function delete($uniqueness)
 {
     $this->connectToAssignedCardStorageInternalWorker->connect()->remove(['uniqueness' => $uniqueness]);
 }