setPublication() публичный Метод

Set publication which user registered with
public setPublication ( integer $publication ) : integer
$publication integer Publication id
Результат integer
Пример #1
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;
 }