Sulu\Bundle\SecurityBundle\Entity\User::setContact PHP Method

setContact() public method

Set contact.
public setContact ( Sulu\Component\Contact\Model\ContactInterface $contact = null ) : self
$contact Sulu\Component\Contact\Model\ContactInterface
return self
    public function setContact(ContactInterface $contact = null)
    {
        $this->contact = $contact;
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 protected function initOrm()
 {
     $this->purgeDatabase();
     $contact = new Contact();
     $contact->setFirstName('Max');
     $contact->setLastName('Mustermann');
     $this->em->persist($contact);
     $this->em->flush();
     $emailType = new EmailType();
     $emailType->setName('Private');
     $this->em->persist($emailType);
     $this->em->flush();
     $email = new Email();
     $email->setEmail('*****@*****.**');
     $email->setEmailType($emailType);
     $this->em->persist($email);
     $this->em->flush();
     $role1 = new Role();
     $role1->setName('Role1');
     $role1->setSystem('Sulu');
     $this->em->persist($role1);
     $this->em->flush();
     $user = new User();
     $user->setUsername('admin');
     $user->setPassword('securepassword');
     $user->setSalt('salt');
     $user->setLocale('de');
     $user->setContact($contact);
     $this->em->persist($user);
     $this->em->flush();
     $userRole1 = new UserRole();
     $userRole1->setRole($role1);
     $userRole1->setUser($user);
     $userRole1->setLocale(json_encode(['de', 'en']));
     $this->em->persist($userRole1);
     $this->em->flush();
     $permission1 = new Permission();
     $permission1->setPermissions(122);
     $permission1->setRole($role1);
     $permission1->setContext('Context 1');
     $this->em->persist($permission1);
     $this->em->flush();
     $tag1 = new Tag();
     $tag1->setName('tag1');
     $this->em->persist($tag1);
     $this->em->flush();
     $tag2 = new Tag();
     $tag2->setName('tag2');
     $this->em->persist($tag2);
     $this->em->flush();
     $tag3 = new Tag();
     $tag3->setName('tag3');
     $this->em->persist($tag3);
     $this->em->flush();
     $tag4 = new Tag();
     $tag4->setName('tag4');
     $this->em->persist($tag4);
     $this->em->flush();
 }
All Usage Examples Of Sulu\Bundle\SecurityBundle\Entity\User::setContact