Instantiate a new product.

@param ProductNumberContract $productNumber
@param ProductTypeContract $productType
@param string $description
@return ProductContract
778676
public static function instantiate(ProductNumberContract $productNumber, ProductTypeContract $productType, $description)
    {
        return new static([
            'product_number' => $productNumber,
            'product_type_id' => $productType->id,
            'description' => $description,
        ]);
    }
582847
public function actionCreate($type)
    {
        $model = new ProductTypeMeta();
        $model->product_type = $type;

        if ($model->loadAll(request()->post())) {
            $model->product_type = $type;
            if ($model->saveAll()) {
                return $this->redirect(['update', 'id' => $model->id]);
            }
        }

        return $this->render('create', [
            'model' => $model,
        ]);
    }
242892
public function update($productId, $file, $data, $storeView = null, $identifierType = null)
    {
        return $this->__createAction('catalogProductAttributeMediaUpdate', func_get_args());
    }
1015503
public function getInfo($productId, $file, $storeView = null, $identifierType = null)
    {
        return $this->__createAction('catalogProductAttributeMediaInfo', func_get_args());
    }
294021
public function actionCreate($type = 'product')
    {
        if (!is_product_type_name($type)) {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
        $model = new TermOfProductType();
        $model->product_type = $type;
        if ($model->loadAll(request()->post())) {
            if (!TermOfProductType::find()
                ->where(['product_type' => $model->product_type])
                ->andWhere(['name' => $model->name])
                ->exists()) {
                if ($model->saveAll()) {
                    return $this->redirect([
                        'update',
                        'id' => $model->id,
                    ]);
                }
            } else {
                $model->addError('name', t('app', 'This name has already been set.'));
            }
        }

        return $this->render('create', [
            'model' => $model,
        ]);
    }
1241493
public function assignProduct($categoryId, $productId, $position = null, $identifierType = null)
    {
        return $this->__createAction('catalog_category.assignProduct', func_get_args());
    }
1366349
public function create(Description $description)
    {
        return new Tip(
            new Identifier($description->getMandatoryProperty('id')),
            $description->getMandatoryProperty('text'),
            $description->getMandatoryProperty('type'),
            $description->getMandatoryProperty('agreeCount'),
            $description->getMandatoryProperty('disagreeCount')
        );
    }
1057315
public function update($type, $productId, $linkedProductId, $data, $identifierType = null)
    {
        return $this->__createAction('catalog_product_link.update', func_get_args());
    }
903538
public function setType(?string $type, string $description = null) {
		$this->type = $type;
		if (null !== $description) {
			$this->setTypeDescription($description);
		}

		return $this;
	}
230762
public static function create($objectNumber, $generationNumber, PdfType $value)
    {
        $v = new self;
        $v->objectNumber = (int) $objectNumber;
        $v->generationNumber = (int) $generationNumber;
        $v->value = $value;

        return $v;
    }
876739
public function addProductorder(\Flowcode\ShopBundle\Entity\ProductOrder $productorders)
    {
        $this->productorders[] = $productorders;

        return $this;
    }
617863
private function createProductVariant(
        ProductInterface $product,
        $productVariantName,
        $price,
        $code,
        ChannelInterface $channel = null,
        $position = null,
        $shippingRequired = true
    ) {
        $product->setVariantSelectionMethod(ProductInterface::VARIANT_SELECTION_CHOICE);

        /** @var ProductVariantInterface $variant */
        $variant = $this->productVariantFactory->createNew();

        $variant->setName($productVariantName);
        $variant->setCode($code);
        $variant->setProduct($product);
        $variant->addChannelPricing($this->createChannelPricingForChannel($price, $channel));
        $variant->setPosition((null === $position) ? null : (int) $position);
        $variant->setShippingRequired($shippingRequired);

        $product->addVariant($variant);

        $this->objectManager->flush();
        $this->sharedStorage->set('variant', $variant);

        return $variant;
    }
689913
private function createProduct($productName, int $price = 100, ChannelInterface $channel = null)
    {
        if (null === $channel && $this->sharedStorage->has('channel')) {
            $channel = $this->sharedStorage->get('channel');
        }

        /** @var ProductInterface $product */
        $product = $this->productFactory->createWithVariant();

        $product->setCode(StringInflector::nameToUppercaseCode($productName));
        $product->setName($productName);
        $product->setSlug($this->slugGenerator->generate($productName));

        if (null !== $channel) {
            $product->addChannel($channel);

            foreach ($channel->getLocales() as $locale) {
                $product->setFallbackLocale($locale->getCode());
                $product->setCurrentLocale($locale->getCode());

                $product->setName($productName);
                $product->setSlug($this->slugGenerator->generate($productName));
            }
        }

        /** @var ProductVariantInterface $productVariant */
        $productVariant = $this->defaultVariantResolver->getVariant($product);

        if (null !== $channel) {
            $productVariant->addChannelPricing($this->createChannelPricingForChannel($price, $channel));
        }

        $productVariant->setCode($product->getCode());
        $productVariant->setName($product->getName());

        return $product;
    }
146038
public function newItemCreateStruct(ItemDefinitionInterface $itemDefinition, $value): ItemCreateStruct
    {
        $struct = new ItemCreateStruct();
        $struct->definition = $itemDefinition;
        $struct->value = $value;

        return $struct;
    }
629576
public function setSpecialPrice(
        $productId,
        $specialPrice,
        $fromDate,
        $toDate,
        $storeView = null,
        $productIdentifierType = null
    ) {
        return $this->__createAction('catalog_product.setSpecialPrice', func_get_args());
    }
630070
public function create($type, $set, $sku, $productData, $storeView = null)
    {
        return $this->__createAction('catalog_product.create', func_get_args());
    }
853670
public function handle(ProductTypeRepository $productTypeRepository, Dispatcher $event)
    {
        $productType = $productTypeRepository->find($this->id);

        // TODO : Check if the product type is in use

        $productTypeRepository->destroy($productType);

        $event->fire(new ProductTypeWasDestroyed($productType));

        return $productType;
    }