asprin
Active member
So the addon that I'm building has this in the Setup file
	
	
	
		
(a) Is this the correct way of inserting initial data in a table inside a Setup file?
(b) Is there a way I can insert multiple rows at once instead of using "$db->insert()" statement for each row?
				
			
		PHP:
	
	public function installStep1()
{
    $this->schemaManager()->createTable('xf_asp_fb_sport', function(Create $table)
    {
        $table->addColumn('sys_id', 'int')->autoIncrement();
        $table->addColumn('title', 'varchar', 20);
        $table->addPrimaryKey('sys_id');
    });
  
    // table has been created, dump some sample data into it
    $db = $this->db();
    $db->insert('xf_asp_fb_sport', [
        'title'  => 'Football'
    ]);
}(a) Is this the correct way of inserting initial data in a table inside a Setup file?
(b) Is there a way I can insert multiple rows at once instead of using "$db->insert()" statement for each row?
 
 
		 
 
		