Page 1 of 1

how function getGenericObject of Factory class works

Posted: Tue Feb 23, 2016 7:14 pm
by joshsard
Hi,

I'm in ScheduleFactory.class.php and I've would like to get 'other_id1' and 'other_id2' column values (aka data) of the Branch object/table, and I saw these codes below, inside the function getScheduleArray:

Code: Select all

'default_branch_id' => (int)$s_obj->getColumn('default_branch_id'),
'default_branch' => $s_obj->getColumn('default_branch'),
...
'job_branch_id' => (int)$s_obj->getColumn('job_branch_id'),
...
'branch_id' => (int)$s_obj->getBranch(),
'branch' => $s_obj->getColumn('branch'),
I wondered how to get the remaining values of the Branch object/table (to be shown as additional columns in the schedule table) with the above code but I did not figure it out.
However, I saw a function inside the same ScheduleFactory class called getBranchObject shown below:

Code: Select all

function getBranchObject() {
	return $this->getGenericObject( 'BranchListFactory', $this->getBranch(), 'branch_obj' );
}
which returns the branch object (probably), so I tried something like this:

Code: Select all

$branch_other_id1 = $s_obj->getBranchObject()->getOtherID1();
but there's no value returned inside $branch_other_id1.
Is my code above correct, or am I missing something?

And also does getGenericObject function of Factory class gets the whole object with all column values attached to it, not just its branch_id?
Thanks

Re: how function getGenericObject of Factory class works

Posted: Sun Feb 28, 2016 6:53 pm
by joshsard
Hi, I have found the solution, the code i showed before actually works, it's just the data having no object that's why there's no value for the getOtherID function. I now have it like below:

Code: Select all

($s_obj->getBranchObject() !== false) ? $s_obj->getBranchObject()->getOtherID1() : ''