本文整理汇总了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;
}
示例2: setUpPlayer
protected function setUpPlayer()
{
$user = new User();
$user->setId(1);
$user->setUsername('ricardo75');
$player = new Player($user, Game::FLIP_TYPE_HEADS);
return $player;
}
示例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));
}
示例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;
}
示例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);
}
示例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());
}
示例7: setId
/**
* {@inheritDoc}
*/
public function setId($id)
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'setId', array($id));
return parent::setId($id);
}
示例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);
}
示例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;
}