This question is similar to Mysql results in PHP - arrays or objects? However, my question expands on what has been discussed there.
I\'m trying to decide which form
I think its better to represent all of your datas and its type in form of Model. For both joined and singular objects. Doing so will always omit your problem.
class Member_Details {
public $id;
public $first_name;
public $last_name;
public function FullName() {
return $this -> first_name." ".$this -> last_name;
}
}
class Member_Address {
public $id;
public $address;
public $city;
}
class MemberJoins {
public $objects = array();
}
After creating such classes you can configures a JOIN in the following way.
$obj_details = new Member_Details();
$obj_address = new Member_Address();
//Add data to the objects and then
//Then create the join object
$obj_address_details = new MemberJoins();
$obj_address_details -> objects = array($obj_details, $obj_address);
These both have a common property id from which its data can be linked.