setAuthor() public method

Set author
public setAuthor ( Author $author = null ) : Newscoop\Entity\User
$author Author
return Newscoop\Entity\User
Exemplo n.º 1
0
 /**
  * Set form defaults
  *
  * @param Newscoop\Entity\User $user
  * @return Admin_Form_User
  */
 public function setDefaultsFromEntity(User $user)
 {
     $types = array();
     foreach ($user->getUserTypes() as $type) {
         $types[] = $type->getId();
     }
     try {
         $user->getAuthorId();
     } catch (\Doctrine\ORM\EntityNotFoundException $e) {
         // deleted author
         $user->setAuthor(null);
     }
     return $this->setDefaults(array('first_name' => $user->getFirstName(), 'last_name' => $user->getLastName(), 'email' => $user->getEmail(), 'username' => $user->getUsername(), 'status' => $user->isActive(), 'is_admin' => $user->isAdmin(), 'is_public' => $user->isPublic(), 'user_type' => $types, 'author' => $user->getAuthorId()));
 }
Exemplo n.º 2
0
 /**
  * Set form defaults
  *
  * @param  Newscoop\Entity\User $user
  * @return Admin_Form_User
  */
 public function setDefaultsFromEntity(User $user)
 {
     $defaults = array('first_name' => $user->getFirstName(), 'last_name' => $user->getLastName(), 'username' => $user->getUsername(), 'attributes' => array());
     $profile = $this->getSubForm('attributes');
     foreach ($profile as $field) {
         $defaults['attributes'][$field->getName()] = (string) $user->getAttribute($field->getName());
     }
     $types = array();
     foreach ($user->getUserTypes() as $type) {
         $types[] = $type->getId();
     }
     try {
         $user->getAuthorId();
     } catch (\Doctrine\ORM\EntityNotFoundException $e) {
         // deleted author
         $user->setAuthor(null);
     }
     $settings = array('first_name' => $user->getFirstName(), 'last_name' => $user->getLastName(), 'email' => $user->getEmail(), 'username' => $user->getUsername(), 'status' => $user->isActive(), 'is_admin' => $user->isAdmin(), 'is_public' => $user->isPublic(), 'is_verified' => $user->getAttribute('is_verified'), 'is_featured' => $user->getAttribute('is_featured'), 'user_type' => $types, 'author' => $user->getAuthorId());
     return $this->setDefaults(array_merge($settings, $defaults));
 }
Exemplo n.º 3
0
 public function setAuthor(\Newscoop\Entity\Author $author = NULL)
 {
     $this->__load();
     return parent::setAuthor($author);
 }