當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::setId方法代碼示例

本文整理匯總了PHP中AppBundle\Entity\User::setId方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::setId方法的具體用法?PHP User::setId怎麽用?PHP User::setId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AppBundle\Entity\User的用法示例。


在下文中一共展示了User::setId方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUpGame

 protected function setUpGame()
 {
     $game = new Game(new RandomHeadTailsGenerator());
     $game->setName('Arizona');
     $user = new User();
     $user->setId(1);
     $user->setUsername('ricardo75');
     $player = new Player($user, Game::FLIP_TYPE_HEADS);
     $game->addPlayer($player);
     $user2 = new User();
     $user->setId(2);
     $user2->setUsername('flipshark');
     $player2 = new Player($user2, Game::FLIP_TYPE_TAILS);
     $game->addPlayer($player2);
     return $game;
 }
開發者ID:richardlawson,項目名稱:coinflip,代碼行數:16,代碼來源:GameJsonEncoderTest.php

示例2: setUpPlayer

 protected function setUpPlayer()
 {
     $user = new User();
     $user->setId(1);
     $user->setUsername('ricardo75');
     $player = new Player($user, Game::FLIP_TYPE_HEADS);
     return $player;
 }
開發者ID:richardlawson,項目名稱:coinflip,代碼行數:8,代碼來源:PlayerJsonEncoderTest.php

示例3: testRemoveUserFromGame

 public function testRemoveUserFromGame()
 {
     $user = new User();
     $user->setId(1);
     $this->assertInstanceOf('AppBundle\\Entity\\Player', $this->em->getRepository('AppBundle:Player')->find(2));
     $game = $this->em->getRepository('AppBundle:Game')->find(6);
     $this->em->getRepository('AppBundle:Game')->removeUserFromGame($user, $game);
     $this->assertEquals(Game::STATE_INITIALIZED, $game->getGameState());
     $this->assertNull($this->em->getRepository('AppBundle:Player')->find(2));
 }
開發者ID:richardlawson,項目名稱:coinflip,代碼行數:10,代碼來源:GameRepositoryTest.php

示例4: __construct

 public function __construct()
 {
     $user = new User();
     $user->setId("1");
     $user->setUsername("test");
     $user->setEmail('test@test.test');
     $user->setPassword("pass");
     $user->setAvatarUrl("default_avatar.jpg");
     $this->user = $user;
 }
開發者ID:redaLaanait,項目名稱:SYMF_MOCK,代碼行數:10,代碼來源:UserServiceMock.php

示例5: test_create_token

 public function test_create_token()
 {
     $user = new User();
     $user->setId(1);
     $user->setUsername('user1');
     $signer = new Sha256();
     $secret = 'test_sign_secret';
     $config = ['issuer' => 'me', 'audience' => 'me', 'appid' => 10, 'expire' => 60, 'notbefore' => 5];
     $issued = Carbon::now();
     $expire = Carbon::now()->addSeconds((int) $config['expire']);
     $notBefore = Carbon::now()->addSeconds((int) $config['notbefore']);
     $builder = $this->prophesize(Builder::class);
     $builder->setIssuer('me')->shouldBeCalledTimes(1)->willReturn($builder->reveal());
     $builder->setAudience('me')->shouldBeCalledTimes(1)->willReturn($builder->reveal());
     $builder->setId(10, true)->shouldBeCalledTimes(1)->willReturn($builder->reveal());
     $builder->setIssuedAt($issued->getTimestamp())->shouldBeCalledTimes(1)->willReturn($builder->reveal());
     $builder->setNotBefore($notBefore->getTimestamp())->shouldBeCalledTimes(1)->willReturn($builder->reveal());
     $builder->setExpiration($expire->getTimestamp())->shouldBeCalledTimes(1)->willReturn($builder->reveal());
     $builder->set('data', ["uid" => $user->getId(), "uidentifier" => $user->getUsername()])->shouldBeCalledTimes(1)->willReturn($builder->reveal());
     $builder->sign($signer, $secret)->shouldBeCalledTimes(1)->willReturn($builder->reveal());
     $builder->getToken()->shouldBeCalledTimes(1)->willReturn(new Token());
     $generator = new TokenGenerator($builder->reveal(), $signer, $secret, $config);
     $generator->createToken($user);
 }
開發者ID:Algatux,項目名稱:symfony3.0,代碼行數:24,代碼來源:TokenGeneratorTest.php

示例6: testOrdre_Actualite

 public function testOrdre_Actualite()
 {
     // Mock d'une page eleveur en base de données
     $user = new User();
     $user->setId(1);
     $pageEleveurBranch = new PageEleveurBranch();
     $pageEleveurBranch->setId(1);
     $pageEleveurBranch->setOwner($user);
     $this->pageEleveurBranchRepository->method('find')->withAnyParameters()->willReturn($pageEleveurBranch);
     $commit1 = $this->newCommit(1);
     $pageEleveurBranch->setCommit($commit1);
     $this->pageEleveurCommitRepository->method('find')->withAnyParameters()->willReturn($commit1);
     //Simulation d'une requete de commit
     $pageEleveur = new PageEleveur();
     $pageEleveur->setId($pageEleveurBranch->getId());
     $pageEleveur->setHead($commit1->getId());
     // Les actu sont commités dans le mauvais ordre
     $pageEleveur->setActualites([new Actualite('actu 1', new \DateTime()), new Actualite('actu 2', (new \DateTime())->add(new \DateInterval('P2D')))]);
     $pageEleveur = $this->pageEleveurService->commit($user, $pageEleveur);
     // commit() doit retourner les actu dans le bon ordre
     $this->assertEquals('actu 2', $pageEleveur->getActualites()[0]->getContenu());
     $this->assertEquals('actu 1', $pageEleveur->getActualites()[1]->getContenu());
 }
開發者ID:apflieger,項目名稱:zigotoo,代碼行數:23,代碼來源:PageEleveurServiceTest.php

示例7: setId

 /**
  * {@inheritDoc}
  */
 public function setId($id)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setId', array($id));
     return parent::setId($id);
 }
開發者ID:3lolo,項目名稱:lr_app,代碼行數:8,代碼來源:__CG__AppBundleEntityUser.php

示例8: testCommit_pas_owner_droit_refuse

 /**
  * @expectedException \AppBundle\Service\HistoryException
  * @expectedExceptionCode \AppBundle\Service\HistoryException::DROIT_REFUSE
  */
 public function testCommit_pas_owner_droit_refuse()
 {
     $user = new User();
     $user->setId(1);
     $pageAnimalBranch = new PageAnimalBranch();
     $pageAnimalBranch->setOwner($user);
     $this->pageAnimalBranchRepository->method('find')->willReturn($pageAnimalBranch);
     $pageAnimal = new PageAnimal();
     $user2 = new User();
     $user2->setId(2);
     $this->pageAnimalService->commit($user2, $pageAnimal);
 }
開發者ID:apflieger,項目名稱:zigotoo,代碼行數:16,代碼來源:PageAnimalServiceTest.php

示例9: getTop

 public function getTop()
 {
     /**
      * @TODO: FIX IT
      * I don't know WHY but I couldn't add the upvoteTotal in the UserEntity...
      * THUS, I have done a workaround thought out RAW SQL
      */
     $result = $this->repository->getTop();
     $data = array();
     foreach ($result as $row) {
         $user = new User();
         $user->setId($row['id']);
         $user->setFirstname($row['firstname']);
         $user->setLastname($row['lastname']);
         $user->setUsername($row['username']);
         $user->setPicturePath($row['picture_path']);
         $user->setUpvoteTotal($row['upvote_total']);
         $data[] = $user;
     }
     return $data;
 }
開發者ID:matheusgontijo,項目名稱:MageBrazuca,代碼行數:21,代碼來源:UserService.php


注:本文中的AppBundle\Entity\User::setId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。