protected function GameBaseball::csvcolumns in Migrate 7.2
1 call to GameBaseball::csvcolumns()
- GameBaseball::__construct in migrate_example_baseball/
migrate_example_baseball.migrate.inc - General initialization of a Migration object.
File
- migrate_example_baseball/
migrate_example_baseball.migrate.inc, line 92 - A baseball game migration example.
Class
- GameBaseball
- A migration that is reused for each source CSV file.
Code
protected function csvcolumns() {
// Note: Remember to subtract 1 from column number at http://www.retrosheet.org/gamelogs/glfields.txt
$columns[0] = array(
'start_date',
'Date of game',
);
$columns[3] = array(
'visiting_team',
'Visiting team',
);
$columns[6] = array(
'home_team',
'Home team',
);
$columns[8] = array(
'home_game_number',
'Home team game number',
);
$columns[9] = array(
'home_score',
'Home score',
);
$columns[10] = array(
'visiting_score',
'Visiting score',
);
$columns[11] = array(
'outs',
'Length of game in outs',
);
$columns[16] = array(
'park_id',
'Ballpark ID',
);
$columns[17] = array(
'attendance',
'Attendance',
);
$columns[18] = array(
'duration',
'Duration in minutes',
);
for ($i = 1; $i <= 9; $i++) {
$columns[103 + 3 * $i] = array(
"visiting_batter_{$i}",
"Visiting batter {$i}",
);
$columns[130 + 3 * $i] = array(
"home_batter_{$i}",
"Home batter {$i}",
);
}
$columns[102] = array(
'visiting_pitcher',
'Visiting starting pitcher',
);
$columns[104] = array(
'home_pitcher',
'Home starting pitcher',
);
return $columns;
}