本文整理汇总了PHP中AppBundle\Entity\User::getFirstName方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getFirstName方法的具体用法?PHP User::getFirstName怎么用?PHP User::getFirstName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::getFirstName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transform
/**
* Transform a Model User to its representation.
*
* @param User|null $user
*
* @return UserRepresentation|null
*/
public function transform($user)
{
if (!$user) {
return;
}
$representation = new UserRepresentation();
$representation->setId($user->getId());
$representation->setUsername($user->getUsername());
$representation->setEmail($user->getEmail());
$representation->setFirstname($user->getFirstName());
return $representation;
}
示例2: getFirstName
/**
* {@inheritDoc}
*/
public function getFirstName()
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getFirstName', array());
return parent::getFirstName();
}
示例3: entityToWebHomeUser
/**
* @param User $user
*
* @return WebHomeUser
*/
public function entityToWebHomeUser(User $user)
{
$model = new WebHomeUser($user->getUsername(), '', $user->getFirstName(), $user->getLastName(), $user->getLocale(), $user->getAccessTokens()->last()->getToken(), '');
return $model;
}
示例4: assertIsValidV2Response
/**
* Test is the given response is valid.
*
* @param Response $response
* @param User $user
*/
private function assertIsValidV2Response(Response $response, User $user)
{
// Response is OK
$this->assertEquals(200, $response->getStatusCode());
$result = $response->getContent();
$content = json_decode($result, true);
// All key are presents
$keys = array('id', 'username', 'email', 'firstname');
foreach ($keys as $key) {
$this->assertArrayHasKey($key, $content);
}
// There is no extra key
foreach ($content as $key => $value) {
$this->assertContains($key, $keys);
}
// all values are valid
$this->assertEquals($user->getId(), $content['id']);
$this->assertEquals($user->getUsername(), $content['username']);
$this->assertEquals($user->getEmail(), $content['email']);
$this->assertEquals($user->getFirstName(), $content['firstname']);
}