app/Functions/FunctionsImport.php
public static function updatePlaces(string $xref, Tree $tree, string $gedrec): void
    {
        preg_match_all('/^[2-9] PLAC (.+)/m', $gedrec, $matches);

        $places = array_unique($matches[1]);

        foreach ($places as $place_name) {
            $place = new Place($place_name, $tree);

            // Calling Place::id() will create the entry in the database, if it doesn't already exist.
            // Link the place to the record
            while ($place->id() !== 0) {
                try {
                    DB::table('placelinks')->insert([
                        'pl_p_id' => $place->id(),
                        'pl_gid'  => $xref,
                        'pl_file' => $tree->id(),
                    ]);
                } catch (PDOException $ex) {
                    // Already linked this place - so presumably also any parent places.
                    break;
                }

                $place = $place->parent();
            }
        }
    }
public static function updatePlaces(string $xref, Tree $tree, string $gedrec): void
    {
        preg_match_all('/^[2-9] PLAC (.+)/m', $gedrec, $matches);

        $places = array_unique($matches[1]);

        foreach ($places as $place_name) {
            $place = new Place($place_name, $tree);

            // Calling Place::id() will create the entry in the database, if it doesn't already exist.
            // Link the place to the record
            while ($place->id() !== 0) {
                try {
                    DB::table('placelinks')->insert([
                        'pl_p_id' => $place->id(),
                        'pl_gid'  => $xref,
                        'pl_file' => $tree->id(),
                    ]);
                } catch (PDOException $ex) {
                    // Already linked this place - so presumably also any parent places.
                    break;
                }

                $place = $place->parent();
            }
        }
    }
public static function updatePlaces ( string $ xref , Tree $ tree , string $ gedrec ) : void { preg_match_all ( '/^[2-9] PLAC (.+)/m' , $ gedrec , $ matches ) ; $ places = array_unique ( $ matches [ 1 ] ) ; foreach ( $ places as $ place_name ) { $ place = new Place ( $ place_name , $ tree ) ; // Calling Place::id() will create the entry in the database, if it doesn't already exist. // Link the place to the record while ( $ place -> id ( ) !== 0 ) { try { DB :: table ( 'placelinks' ) -> insert ( [ 'pl_p_id' => $ place -> id ( ) , 'pl_gid' => $ xref , 'pl_file' => $ tree -> id ( ) , ] ) ; } catch ( PDOException $ ex ) { // Already linked this place - so presumably also any parent places. break ; } $ place = $ place -> parent ( ) ; } } }
Extract all level 2 places from the given record and insert them into the places table

@param string $xref
@param Tree   $tree
@param string $gedrec

@return void
Extract all level 2 places from the given record and insert them into the places table