public static function recordIntoMSelectArray( $record, $tableBindery, $tableMSelect, $mSelectNameMethod = 'getName') { $arrResult = array(); $binderyMethod = 'get' . $tableBindery . 'Join' . $tableMSelect; $arrBinderyRecords = $record->$binderyMethod(); foreach ($arrBinderyRecords as $binderyRecord) { $getMSelectRecordId = 'get' . $tableMSelect . 'Id'; $mSelectRecordId = $binderyRecord->$getMSelectRecordId(); $mSelectRecord = call_user_func( array($tableMSelect . 'Peer', 'retrieveByPK'), $mSelectRecordId ); $arrResult[$mSelectRecordId] = $mSelectRecord->$mSelectNameMethod(); } return $arrResult; }