getAttributes() public method

Get all user attributes
public getAttributes ( ) : array
return array of all user attributes
Example #1
0
 public function testDeleteActive()
 {
     $this->user->setActive(true);
     $this->em->persist($this->user);
     $this->em->flush();
     $this->user->addAttribute('tic', 'toc');
     $this->em->persist($this->user);
     $this->em->flush();
     $this->assertTrue($this->user->isActive());
     $this->auth->expects($this->once())->method('getIdentity')->will($this->returnValue(3));
     sleep(2);
     // for testing difference in create/update time
     $this->service->delete($this->user);
     $this->assertFalse($this->user->isActive());
     $this->assertFalse($this->user->isPublic());
     $this->assertFalse($this->user->isAdmin());
     $this->assertEmpty($this->user->getEmail());
     $this->assertEmpty($this->user->getFirstName());
     $this->assertEmpty($this->user->getLastName());
     $this->assertEmpty($this->user->getAttribute('tic'));
     $this->assertEmpty($this->user->getAttributes());
     $this->assertGreaterThan($this->user->getCreated()->getTimestamp(), $this->user->getUpdated()->getTimestamp());
 }
 public function getAttributes()
 {
     $this->__load();
     return parent::getAttributes();
 }
Example #3
0
 /**
  * Add user attributes subform to form
  *
  * @param  Zend_Form            $form
  * @param  Newscoop\Entity\User $user
  * @return void
  */
 private function addUserAttributesSubForm(Zend_Form $form, User $user)
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     $subForm = new Zend_Form_SubForm();
     $subForm->setLegend($translator->trans('User attributes', array(), 'users'));
     foreach ($user->getRawAttributes() as $key => $val) {
         $subForm->addElement('text', $key, array('label' => $key));
     }
     $subForm->setDefaults($user->getAttributes());
     $form->addSubForm($subForm, 'attributes');
 }