setFirstName() public method

Set first name
public setFirstName ( string $first_name ) : Newscoop\Entity\User
$first_name string
return Newscoop\Entity\User
示例#1
0
 public function setUp()
 {
     parent::setUp('Newscoop\\Entity\\User', 'Newscoop\\Entity\\Acl\\Role', 'Newscoop\\Entity\\UserAttribute');
     $this->auth = $this->getMockBuilder('Zend_Auth')->disableOriginalConstructor()->getMock();
     $this->repository = $this->em->getRepository('Newscoop\\Entity\\User');
     $this->service = new UserService($this->em, $this->auth);
     $this->user = new User();
     $this->user->setEmail('*****@*****.**');
     $this->user->setUsername('test');
     $this->user->setFirstName('Foo');
     $this->user->setLastName('Bar');
 }
 public function setFirstName($first_name)
 {
     $this->__load();
     return parent::setFirstName($first_name);
 }
示例#3
0
 /**
  * Create new activated user
  *
  * @param string  $email
  * @param string  $password
  * @param string  $firstName
  * @param string  $lastName
  * @param integer $publication
  */
 public function createUser($email, $password, $username, $firstName = null, $lastName = null, $publication = 0, $public = true, $userTypes = array(), $isAdmin = false)
 {
     $users = $this->findBy(array('email' => $email));
     if (!empty($users)) {
         throw new \Newscoop\Exception\ResourcesConflictException("User with this email already exists");
     }
     $user = new User($email);
     $user->setPassword($password);
     $user->setUsername($username);
     $user->setPublic($public);
     $user->setActive();
     $user->setFirstName($firstName);
     $user->setLastName($lastName);
     $user->setPublication($publication);
     $user->setAdmin($isAdmin);
     foreach ($userTypes as $type) {
         $user->addUserType($this->em->getReference('Newscoop\\Entity\\User\\Group', $type));
     }
     $this->em->persist($user);
     $this->em->flush();
     return $user;
 }