app/Module/BatchUpdateModule.php
private function allData(BatchUpdateBasePlugin $plugin, Tree $tree): array
    {
        $tmp = [];

        foreach ($plugin->getRecordTypesToUpdate() as $type) {
            switch ($type) {
                case 'INDI':
                    $rows = DB::table('individuals')
                        ->where('i_file', '=', $tree->id())
                        ->select(['i_id AS xref', DB::raw("'INDI' AS type"), 'i_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                case 'FAM':
                    $rows = DB::table('families')
                        ->where('f_file', '=', $tree->id())
                        ->select(['f_id AS xref', DB::raw("'FAM' AS type"), 'f_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                case 'SOUR':
                    $rows = DB::table('sources')
                        ->where('s_file', '=', $tree->id())
                        ->select(['s_id AS xref', DB::raw("'SOUR' AS type"), 's_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                case 'OBJE':
                    $rows = DB::table('media')
                        ->where('m_file', '=', $tree->id())
                        ->select(['m_id AS xref', DB::raw("'OBJE' AS type"), 'm_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                default:
                    $rows = DB::table('other')
                        ->where('o_file', '=', $tree->id())
                        ->where('o_type', '=', $type)
                        ->select(['o_id AS xref', 'o_type AS type', 'o_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;
            }
        }

        $data = [];

        foreach ($tmp as $value) {
            $data[$value->xref] = $value;
        }

        ksort($tmp);

        return $data;
    }
private function allData(BatchUpdateBasePlugin $plugin, Tree $tree): array
    {
        $tmp = [];

        foreach ($plugin->getRecordTypesToUpdate() as $type) {
            switch ($type) {
                case 'INDI':
                    $rows = DB::table('individuals')
                        ->where('i_file', '=', $tree->id())
                        ->select(['i_id AS xref', DB::raw("'INDI' AS type"), 'i_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                case 'FAM':
                    $rows = DB::table('families')
                        ->where('f_file', '=', $tree->id())
                        ->select(['f_id AS xref', DB::raw("'FAM' AS type"), 'f_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                case 'SOUR':
                    $rows = DB::table('sources')
                        ->where('s_file', '=', $tree->id())
                        ->select(['s_id AS xref', DB::raw("'SOUR' AS type"), 's_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                case 'OBJE':
                    $rows = DB::table('media')
                        ->where('m_file', '=', $tree->id())
                        ->select(['m_id AS xref', DB::raw("'OBJE' AS type"), 'm_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                default:
                    $rows = DB::table('other')
                        ->where('o_file', '=', $tree->id())
                        ->where('o_type', '=', $type)
                        ->select(['o_id AS xref', 'o_type AS type', 'o_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;
            }
        }

        $data = [];

        foreach ($tmp as $value) {
            $data[$value->xref] = $value;
        }

        ksort($tmp);

        return $data;
    }
private function allData ( BatchUpdateBasePlugin $ plugin , Tree $ tree ) : array { $ tmp = [ ] ; foreach ( $ plugin -> getRecordTypesToUpdate ( ) as $ type ) { switch ( $ type ) { case 'INDI' : $ rows = DB :: table ( 'individuals' ) -> where ( 'i_file' , '=' , $ tree -> id ( ) ) -> select ( [ 'i_id AS xref' , DB :: raw ( "'INDI' AS type" ) , 'i_gedcom AS gedcom' ] ) -> get ( ) ; $ tmp = array_merge ( $ tmp , $ rows -> all ( ) ) ; break ; case 'FAM' : $ rows = DB :: table ( 'families' ) -> where ( 'f_file' , '=' , $ tree -> id ( ) ) -> select ( [ 'f_id AS xref' , DB :: raw ( "'FAM' AS type" ) , 'f_gedcom AS gedcom' ] ) -> get ( ) ; $ tmp = array_merge ( $ tmp , $ rows -> all ( ) ) ; break ; case 'SOUR' : $ rows = DB :: table ( 'sources' ) -> where ( 's_file' , '=' , $ tree -> id ( ) ) -> select ( [ 's_id AS xref' , DB :: raw ( "'SOUR' AS type" ) , 's_gedcom AS gedcom' ] ) -> get ( ) ; $ tmp = array_merge ( $ tmp , $ rows -> all ( ) ) ; break ; case 'OBJE' : $ rows = DB :: table ( 'media' ) -> where ( 'm_file' , '=' , $ tree -> id ( ) ) -> select ( [ 'm_id AS xref' , DB :: raw ( "'OBJE' AS type" ) , 'm_gedcom AS gedcom' ] ) -> get ( ) ; $ tmp = array_merge ( $ tmp , $ rows -> all ( ) ) ; break ; default : $ rows = DB :: table ( 'other' ) -> where ( 'o_file' , '=' , $ tree -> id ( ) ) -> where ( 'o_type' , '=' , $ type ) -> select ( [ 'o_id AS xref' , 'o_type AS type' , 'o_gedcom AS gedcom' ] ) -> get ( ) ; $ tmp = array_merge ( $ tmp , $ rows -> all ( ) ) ; break ; } } $ data = [ ] ; foreach ( $ tmp as $ value ) { $ data [ $ value -> xref ] = $ value ; } ksort ( $ tmp ) ; return $ data ; }
Fetch all records that might need updating.

@param BatchUpdateBasePlugin $plugin
@param Tree                  $tree

@return object[]
Fetch all records that might need updating .