当前位置: 首页>>代码示例>>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;未经允许,请勿转载。