SHARE
TWEET

Untitled

a guest May 21st, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace Entities;
  4.  
  5. use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
  6.  
  7. class User
  8. {
  9.     public static function loadMetadata(ClassMetadata $metadata)
  10.     {
  11.         $metadata->mapManyEmbedded(array(
  12.             'fieldName' => 'addresses',
  13.             'targetEntity' => 'Entities\Address'
  14.         ));
  15.         $metadata->mapOneEmbedded(array(
  16.             'fieldName' => 'profile',
  17.             'targetEntity' => 'Entities\Profile'
  18.         ));
  19.         $metadata->mapOneAssociation(array(
  20.             'fieldName' => 'account',
  21.             'targetEntity' => 'Entities\Account',
  22.             'emulate' => true,
  23.             'cascadeDelete' => true
  24.            
  25.         ));
  26.         $metadata->mapOneAssociation(array(
  27.             'fieldName' => 'accountReference',
  28.             'targetEntity' => 'Entities\Account'
  29.         ));
  30.         $metadata->mapManyAssociation(array(
  31.             'fieldName' => 'phonenumbers',
  32.             'targetEntity' => 'Entities\Phonenumber',
  33.             'cascadeDelete' => true
  34.         ));
  35.     }
  36.  
  37.     private $id;
  38.     private $username;
  39.     private $password;
  40.     private $addresses = array();
  41.     private $profile;
  42.     private $account;
  43.     private $accountReference;
  44.     private $phonenumbers = array();
  45.  
  46.     public function getId()
  47.     {
  48.         return $this->id;
  49.     }
  50.  
  51.     public function getUsername()
  52.     {
  53.         return $this->username;
  54.     }
  55.  
  56.     public function setUsername($username)
  57.     {
  58.         $this->username = $username;
  59.     }
  60.  
  61.     public function getPassword()
  62.     {
  63.         return $this->password;
  64.     }
  65.  
  66.     public function setPassword($password)
  67.     {
  68.         $this->password = md5($password);
  69.     }
  70.  
  71.     public function getAddresses()
  72.     {
  73.         return $this->addresses;
  74.     }
  75.  
  76.     public function addAddress(Address $address)
  77.     {
  78.         $this->addresses[] = $address;
  79.     }
  80.  
  81.     public function setProfile(Profile $profile)
  82.     {
  83.         $this->profile = $profile;
  84.     }
  85.  
  86.     public function getProfile()
  87.     {
  88.         return $this->profile;
  89.     }
  90.  
  91.     public function setAccount(Account $account)
  92.     {
  93.         $this->account = $account;
  94.     }
  95.  
  96.     public function getAccount()
  97.     {
  98.         return $this->account;
  99.     }
  100.  
  101.     public function setAccountReference(Account $accountReference)
  102.     {
  103.         $this->accountReference = $accountReference;
  104.     }
  105.  
  106.     public function getAccountReference()
  107.     {
  108.         return $this->accountReference;
  109.     }
  110.  
  111.     public function getPhonenumbers()
  112.     {
  113.         return $this->phonenumbers;
  114.     }
  115.  
  116.     public function addPhonenumber(Phonenumber $phonenumber)
  117.     {
  118.         $this->phonenumbers[] = $phonenumber;
  119.     }
  120. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top