Beispiel #1
0
 public function findByOauthId($provider, $uid)
 {
     $found = $this->userRepository->findOne([MapAlias::CLASS_KEY => $this->userClassAlias, 'cred' => [MapAlias::CLASS_KEY => 'oauth', 'uid' => $uid, 'provider' => $provider]]);
     if (is_null($found)) {
         throw new UsernameNotFoundException("We don't know [{$provider}, {$uid}]");
     }
     return $found;
 }
Beispiel #2
0
 /**
  * Get the unique entity in database (or create it)
  *
  * @return ParameterBag
  */
 protected function getUniqueInstance()
 {
     $singleton = $this->repo->findOne(['-class' => 'config']);
     if (is_null($singleton)) {
         $singleton = new ParameterBag($this->defaultParam);
     }
     return $singleton;
 }
Beispiel #3
0
 protected function initDbWithOnePublishingWithReportedComment()
 {
     $author = [];
     foreach (['kirk', 'spock', 'mccoy'] as $nick) {
         $author[] = new Author($nick);
     }
     $doc = new SmallTalk($author[0]);
     $comm = new Commentary($author[1]);
     $comm->report($author[2]);
     $comm->report($author[0]);
     $doc->attachCommentary($comm);
     $this->coll->drop();
     $this->repo->persist($doc);
 }