addSampleData example

/** * {@inheritdoc} */
  protected static $modules = ['database_test'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->connection = Database::getConnection();
    $this->addSampleData();
  }

}

  protected static $modules = ['database_test'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->installSampleSchema();
    $this->addSampleData();
  }

}


class Migrations_Migration372 extends Shopware\Components\Migrations\AbstractMigration
{
    public function up($modus)
    {
        $this->createTables();
        $this->addAcl();
        $this->addSampleData();
    }

    private function createTables()
    {
        $sql = <<<'EOD' CREATE TABLE IF NOT EXISTS `s_multi_edit_filter` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL COMMENT 'Name of the filter', `filter_string` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'The actual filter string', `description` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'User description of the filter', `created` datetime DEFAULT 0 COMMENT 'Creation date', `is_favorite` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Did the user mark this filter as favorite?', `is_simple` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Can the filter be loaded and modified with the simple editor?', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 COMMENT 'Holds all multi edit filters';

  protected $connection;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->connection = Database::getConnection();
    $this->installSampleSchema();
    $this->addSampleData();
  }

  /** * Sets up tables for NULL handling. */
  public function ensureSampleDataNull() {
    $this->connection->insert('test_null')
      ->fields(['name', 'age'])
      ->values([
        'name' => 'Kermit',
        'age' => 25,
      ])
Home | Imprint | This part of the site doesn't use cookies.