I am implementing a php class that must model this :
/** @Document */
classMember {
/** @String */
protected $fname;
/** @String */
protected $lname;
/** @String */
protected $email;
/** @Int */
protected $cell;
/** @String */
protected $password;
/** @Int */
protected $gender;
/** @Int */
protected $loc = array();
/** ????? */
protected $info;
}
I want info field to hold this structure in itself :
info Object
[
contact ["phoneNumber1" , "phoneNumber2"] ,
address ["USA, NY 8791 John St."] ,
email ["[email protected]", "[email protected]"]
]
Should i implement another info.php class?If not,how can i implement this? Thanks for any help...
$info
may use an Embed One mapping. The class you embed would then have mappings for the contact
, address
, and email
fields.
If contact
and email
are really intended to hold multiple phone numbers and email addresses, respectively, then I would suggest using the Collection mapping, which is an arbitrary array of unmapped values. Alternatively, these could be Embed Many relationships to PhoneNumber and Email objects, but that may be unnecessary overhead since it would entail storing an array of single-field (I assume) objects, instead of an array of strings.
I'm not sure why you represented the address
field as an array of strings, but that would benefit from being an Embed Many relationship of Address objects. Address would then have specific fields (e.g. country, province/state). Allowing the user to enter their address as a single string may be convenient, but it makes data management and validation a nightmare.