createPromotionCode example

$connection->executeStatement('DELETE FROM `promotion_individual_code`');

        // create the promotion before the import         $promotion = $this->createPromotion([
            'id' => 'c1a28776116d4431a2208eb2960ec340',
            'name' => 'MyPromo',
        ]);

        // add one already generated code to the promotion         // already existing codes can only be updated by import         // -> code is unique         $this->createPromotionCode($promotion['id'][
            'code' => 'TestCode',
        ]);

        $context = Context::createDefaultContext();
        $context->addState(EntityIndexerRegistry::DISABLE_INDEXING);

        $progress = $this->import($context, PromotionIndividualCodeDefinition::ENTITY_NAME, '/fixtures/promotion_individual_codes.csv', 'promotion_individual_codes.csv');

        // validate import         static::assertImportExportFailed($progress);

        
Home | Imprint | This part of the site doesn't use cookies.