Been knocking my head off the desk on this one all day.
// Iterate over project array to populate release data
for ($i = 0; $i < count($data); $i++) {
$data[$i]->setProjectReleaseSchedule( $proj_scheds[$i] );
//Get each projects Est and Act hours
$options = new stdClass;
$options->default = true;
$options->project_id = $data[$i]->getProjectId();
$options->department_id = $person_dm->getPersonDepartmentId();
//works; AKA: property get assigned an int thatr incriments evern loop
//$data[$i]->data->proj_hours = $this->counter++;
//$weekly_report_dm->getProjectHours returns an object w/ populated properties
$data[$i]->data->proj_hours = $weekly_report_dm->getProjectHours($options);
//As a test, this dumps what is expected...
echo'<pre>';
print_r( $data[$i]->data->proj_hours );
echo'</pre>';
}
echo'<pre>';
//After the loop completes and I try to dump the data the property $data->data->proj_hours is assigned an object..
//but the object properties are all null :(.
print_r( $data );
echo'</pre>';
exit;
So as you can see Im looping over an array of objects; for each object I got another method for data, it returns with expected data. The "print_r( $data[$i]->data->proj_hours );". However, once the loop finishes and I try to dump the data the object is assigned to the parent, but the properties of said object are null/blank.
So the question: Why can I assign INTs, STRINGS, etc to an objects property and they persist outside the foreach loop. But an objects properties when assigned to a parent object inside a foreach loop, the values do not persist?