本文整理汇总了PHP中AppBundle\Entity\User::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getName方法的具体用法?PHP User::getName怎么用?PHP User::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUserImageResponse
private function createUserImageResponse(User $user, Image $image)
{
return new Response(join(' / ', [$user->getId(), $user->getName(), $image->getId()]), Response::HTTP_OK);
}
开发者ID:naoyes,项目名称:2015-nov-quartet-tech-blog-paramconverter-sample,代码行数:4,代码来源:DefaultController.php
示例2: getName
/**
* {@inheritDoc}
*/
public function getName()
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getName', array());
return parent::getName();
}
示例3: validateGetGameResponse
/**
* @param array $game
* @param int $gameId
* @param User $user
* @param array $playerShips
* @param User $otherUser
* @param int $playerNumber
* @param int $lessThanAgo (in seconds)
*/
protected function validateGetGameResponse(array $game, $gameId, User $user = null, array $playerShips = [], User $otherUser = null, $playerNumber = 1, $lessThanAgo = 120)
{
$expectedKeys = ['id', 'playerShips', 'playerNumber', 'timestamp'];
if ($user) {
$expectedKeys[] = 'player';
}
if ($otherUser) {
$expectedKeys[] = 'other';
}
$gameKeys = array_keys($game);
sort($expectedKeys);
sort($gameKeys);
$this->assertEquals($expectedKeys, $gameKeys);
$this->assertEquals($gameId, $game['id'], 'Incorrect game id');
if ($user) {
$this->assertEquals(['name' => $user->getName()], $game['player'], 'Incorrect player details');
}
$this->assertEquals($playerShips, $game['playerShips'], 'Incorrect player ships');
$this->assertEquals($playerNumber, $game['playerNumber'], 'Incorrect player number');
if ($otherUser) {
$this->assertEquals(['name' => $otherUser->getName()], $game['other'], 'Incorrect other details');
}
// not more than X seconds ago
$timestamp = new \DateTime($game['timestamp']);
$this->assertLessThan($lessThanAgo, time() - $timestamp->getTimestamp());
}