/** * 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())); }
/** * 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)); }
public function getAuthorId() { $this->__load(); return parent::getAuthorId(); }