当前位置: 首页>>代码示例>>PHP>>正文


PHP User::setAvatarUrl方法代码示例

本文整理汇总了PHP中AppBundle\Entity\User::setAvatarUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setAvatarUrl方法的具体用法?PHP User::setAvatarUrl怎么用?PHP User::setAvatarUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppBundle\Entity\User的用法示例。


在下文中一共展示了User::setAvatarUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __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

示例2: load

 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('admin');
     $user->setPassword('$2a$08$jHZj/wJfcVKlIwr5AvR78euJxYK7Ku5kURNhNx.7.CSIJ3Pq6LEPC');
     $user->setEmail("test@test.com");
     $user->setAvatarUrl("default_avatar.jpg");
     $manager->persist($user);
     $manager->flush();
 }
开发者ID:redaLaanait,项目名称:SYMF_MOCK,代码行数:10,代码来源:LoadUserData.php

示例3: uploadUserAvatar

 public function uploadUserAvatar(User $user)
 {
     /**
      * @var UploadedFile $file
      */
     $file = $user->getAvatarUrl();
     if ($file != null) {
         $username = trim($user->getUsername());
         $username = preg_replace('/\\s+/', '_', $username);
         $fileName = $username . '_avatar.' . $file->guessExtension();
         $avatarsDir = $this->kernelRootDir . '' . self::USER_AVATAR_DIR;
         $file->move($avatarsDir, $fileName);
         $user->setAvatarUrl($fileName);
     }
 }
开发者ID:redaLaanait,项目名称:SYMF_MOCK,代码行数:15,代码来源:UserService.php

示例4: testUpdateUser

 public function testUpdateUser()
 {
     $user = new User();
     $user->setUsername("user1");
     $user->setPassword("\$2y\$13\$9z7J/8pHLBd4OC7sJQZiFe.C79rBWzByn0Z9V4Viu5hESJ2E4cvj2");
     $user->setEmail("username1@test.com");
     $user->setAvatarUrl("user3_avatar.jpg");
     $this->em->persist($user);
     // Not using createUser from our repository, not safe
     $this->em->flush();
     $newUser = $this->repository->find($user->getId());
     $newUsername = "newUsername";
     $newUser->setUsername($newUsername);
     $this->repository->updateUser($newUser);
     $updatedUser = $this->repository->find($newUser->getId());
     $this->assertNotNull($updatedUser);
     $this->assertEquals($updatedUser->getId(), $newUser->getId());
     $this->assertEquals($updatedUser->getUsername(), $newUser->getUsername());
     $this->assertEquals($updatedUser->getEmail(), $newUser->getEmail());
     $this->assertEquals($updatedUser->getPassword(), $newUser->getPassword());
     // TODO find a way to compare two objects
 }
开发者ID:redaLaanait,项目名称:SYMF_MOCK,代码行数:22,代码来源:UserRepositoryTest.php


注:本文中的AppBundle\Entity\User::setAvatarUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。