commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
Product
ProductDraftBuilder.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Product
;
10
11
use
Commercetools\Api\Models\Category\CategoryResourceIdentifierCollection
;
12
use
Commercetools\Api\Models\Common\LocalizedString
;
13
use
Commercetools\Api\Models\Common\LocalizedStringBuilder
;
14
use
Commercetools\Api\Models\ProductType\ProductTypeResourceIdentifier
;
15
use
Commercetools\Api\Models\ProductType\ProductTypeResourceIdentifierBuilder
;
16
use
Commercetools\Api\Models\State\StateResourceIdentifier
;
17
use
Commercetools\Api\Models\State\StateResourceIdentifierBuilder
;
18
use
Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier
;
19
use
Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierBuilder
;
20
use
Commercetools\Base\Builder
;
21
use
Commercetools\Base\DateTimeImmutableCollection
;
22
use
Commercetools\Base\JsonObject
;
23
use
Commercetools\Base\JsonObjectModel
;
24
use
Commercetools\Base\MapperFactory
;
25
use stdClass;
26
30
final
class
ProductDraftBuilder
implements
Builder
31
{
36
private
$productType;
37
42
private
$name;
43
48
private
$slug;
49
54
private
$key;
55
60
private
$description;
61
66
private
$categories;
67
72
private
$categoryOrderHints;
73
78
private
$metaTitle;
79
84
private
$metaDescription;
85
90
private
$metaKeywords;
91
96
private
$masterVariant;
97
102
private
$variants;
103
108
private
$taxCategory;
109
114
private
$searchKeywords;
115
120
private
$state;
121
126
private
$publish;
127
132
private
$priceMode;
133
140
public
function
getProductType
()
141
{
142
return
$this->productType instanceof
ProductTypeResourceIdentifierBuilder
? $this->productType->
build
() : $this->productType;
143
}
144
151
public
function
getName
()
152
{
153
return
$this->name instanceof
LocalizedStringBuilder
? $this->name->
build
() : $this->name;
154
}
155
164
public
function
getSlug
()
165
{
166
return
$this->slug instanceof
LocalizedStringBuilder
? $this->slug->
build
() : $this->slug;
167
}
168
177
public
function
getKey
()
178
{
179
return
$this->key;
180
}
181
188
public
function
getDescription
()
189
{
190
return
$this->description instanceof
LocalizedStringBuilder
? $this->description->
build
() : $this->description;
191
}
192
199
public
function
getCategories
()
200
{
201
return
$this->categories;
202
}
203
210
public
function
getCategoryOrderHints
()
211
{
212
return
$this->categoryOrderHints instanceof
CategoryOrderHintsBuilder
? $this->categoryOrderHints->
build
() : $this->categoryOrderHints;
213
}
214
221
public
function
getMetaTitle
()
222
{
223
return
$this->metaTitle instanceof
LocalizedStringBuilder
? $this->metaTitle->
build
() : $this->metaTitle;
224
}
225
232
public
function
getMetaDescription
()
233
{
234
return
$this->metaDescription instanceof
LocalizedStringBuilder
? $this->metaDescription->
build
() : $this->metaDescription;
235
}
236
243
public
function
getMetaKeywords
()
244
{
245
return
$this->metaKeywords instanceof
LocalizedStringBuilder
? $this->metaKeywords->
build
() : $this->metaKeywords;
246
}
247
254
public
function
getMasterVariant
()
255
{
256
return
$this->masterVariant instanceof
ProductVariantDraftBuilder
? $this->masterVariant->
build
() : $this->masterVariant;
257
}
258
265
public
function
getVariants
()
266
{
267
return
$this->variants;
268
}
269
276
public
function
getTaxCategory
()
277
{
278
return
$this->taxCategory instanceof
TaxCategoryResourceIdentifierBuilder
? $this->taxCategory->
build
() : $this->taxCategory;
279
}
280
287
public
function
getSearchKeywords
()
288
{
289
return
$this->searchKeywords instanceof
SearchKeywordsBuilder
? $this->searchKeywords->
build
() : $this->searchKeywords;
290
}
291
298
public
function
getState
()
299
{
300
return
$this->state instanceof
StateResourceIdentifierBuilder
? $this->state->
build
() : $this->state;
301
}
302
309
public
function
getPublish
()
310
{
311
return
$this->publish;
312
}
313
320
public
function
getPriceMode
()
321
{
322
return
$this->priceMode;
323
}
324
329
public
function
withProductType
(?
ProductTypeResourceIdentifier
$productType)
330
{
331
$this->productType = $productType;
332
333
return
$this;
334
}
335
340
public
function
withName
(?
LocalizedString
$name)
341
{
342
$this->name = $name;
343
344
return
$this;
345
}
346
351
public
function
withSlug
(?
LocalizedString
$slug)
352
{
353
$this->slug = $slug;
354
355
return
$this;
356
}
357
362
public
function
withKey
(?
string
$key)
363
{
364
$this->key = $key;
365
366
return
$this;
367
}
368
373
public
function
withDescription
(?
LocalizedString
$description)
374
{
375
$this->description = $description;
376
377
return
$this;
378
}
379
384
public
function
withCategories
(?
CategoryResourceIdentifierCollection
$categories)
385
{
386
$this->categories = $categories;
387
388
return
$this;
389
}
390
395
public
function
withCategoryOrderHints
(?
CategoryOrderHints
$categoryOrderHints)
396
{
397
$this->categoryOrderHints = $categoryOrderHints;
398
399
return
$this;
400
}
401
406
public
function
withMetaTitle
(?
LocalizedString
$metaTitle)
407
{
408
$this->metaTitle = $metaTitle;
409
410
return
$this;
411
}
412
417
public
function
withMetaDescription
(?
LocalizedString
$metaDescription)
418
{
419
$this->metaDescription = $metaDescription;
420
421
return
$this;
422
}
423
428
public
function
withMetaKeywords
(?
LocalizedString
$metaKeywords)
429
{
430
$this->metaKeywords = $metaKeywords;
431
432
return
$this;
433
}
434
439
public
function
withMasterVariant
(?
ProductVariantDraft
$masterVariant)
440
{
441
$this->masterVariant = $masterVariant;
442
443
return
$this;
444
}
445
450
public
function
withVariants
(?
ProductVariantDraftCollection
$variants)
451
{
452
$this->variants = $variants;
453
454
return
$this;
455
}
456
461
public
function
withTaxCategory
(?
TaxCategoryResourceIdentifier
$taxCategory)
462
{
463
$this->taxCategory = $taxCategory;
464
465
return
$this;
466
}
467
472
public
function
withSearchKeywords
(?
SearchKeywords
$searchKeywords)
473
{
474
$this->searchKeywords = $searchKeywords;
475
476
return
$this;
477
}
478
483
public
function
withState
(?
StateResourceIdentifier
$state)
484
{
485
$this->state = $state;
486
487
return
$this;
488
}
489
494
public
function
withPublish
(?
bool
$publish)
495
{
496
$this->publish = $publish;
497
498
return
$this;
499
}
500
505
public
function
withPriceMode
(?
string
$priceMode)
506
{
507
$this->priceMode = $priceMode;
508
509
return
$this;
510
}
511
516
public
function
withProductTypeBuilder
(?
ProductTypeResourceIdentifierBuilder
$productType)
517
{
518
$this->productType = $productType;
519
520
return
$this;
521
}
522
527
public
function
withNameBuilder
(?
LocalizedStringBuilder
$name)
528
{
529
$this->name = $name;
530
531
return
$this;
532
}
533
538
public
function
withSlugBuilder
(?
LocalizedStringBuilder
$slug)
539
{
540
$this->slug = $slug;
541
542
return
$this;
543
}
544
549
public
function
withDescriptionBuilder
(?
LocalizedStringBuilder
$description)
550
{
551
$this->description = $description;
552
553
return
$this;
554
}
555
560
public
function
withCategoryOrderHintsBuilder
(?
CategoryOrderHintsBuilder
$categoryOrderHints)
561
{
562
$this->categoryOrderHints = $categoryOrderHints;
563
564
return
$this;
565
}
566
571
public
function
withMetaTitleBuilder
(?
LocalizedStringBuilder
$metaTitle)
572
{
573
$this->metaTitle = $metaTitle;
574
575
return
$this;
576
}
577
582
public
function
withMetaDescriptionBuilder
(?
LocalizedStringBuilder
$metaDescription)
583
{
584
$this->metaDescription = $metaDescription;
585
586
return
$this;
587
}
588
593
public
function
withMetaKeywordsBuilder
(?
LocalizedStringBuilder
$metaKeywords)
594
{
595
$this->metaKeywords = $metaKeywords;
596
597
return
$this;
598
}
599
604
public
function
withMasterVariantBuilder
(?
ProductVariantDraftBuilder
$masterVariant)
605
{
606
$this->masterVariant = $masterVariant;
607
608
return
$this;
609
}
610
615
public
function
withTaxCategoryBuilder
(?
TaxCategoryResourceIdentifierBuilder
$taxCategory)
616
{
617
$this->taxCategory = $taxCategory;
618
619
return
$this;
620
}
621
626
public
function
withSearchKeywordsBuilder
(?
SearchKeywordsBuilder
$searchKeywords)
627
{
628
$this->searchKeywords = $searchKeywords;
629
630
return
$this;
631
}
632
637
public
function
withStateBuilder
(?
StateResourceIdentifierBuilder
$state)
638
{
639
$this->state = $state;
640
641
return
$this;
642
}
643
644
public
function
build
():
ProductDraft
645
{
646
return
new
ProductDraftModel
(
647
$this->productType instanceof
ProductTypeResourceIdentifierBuilder
? $this->productType->
build
() : $this->productType,
648
$this->name instanceof
LocalizedStringBuilder
? $this->name->
build
() : $this->name,
649
$this->slug instanceof
LocalizedStringBuilder
? $this->slug->
build
() : $this->slug,
650
$this->key,
651
$this->description instanceof
LocalizedStringBuilder
? $this->description->
build
() : $this->description,
652
$this->categories,
653
$this->categoryOrderHints instanceof
CategoryOrderHintsBuilder
? $this->categoryOrderHints->
build
() : $this->categoryOrderHints,
654
$this->metaTitle instanceof
LocalizedStringBuilder
? $this->metaTitle->
build
() : $this->metaTitle,
655
$this->metaDescription instanceof
LocalizedStringBuilder
? $this->metaDescription->
build
() : $this->metaDescription,
656
$this->metaKeywords instanceof
LocalizedStringBuilder
? $this->metaKeywords->
build
() : $this->metaKeywords,
657
$this->masterVariant instanceof
ProductVariantDraftBuilder
? $this->masterVariant->
build
() : $this->masterVariant,
658
$this->variants,
659
$this->taxCategory instanceof
TaxCategoryResourceIdentifierBuilder
? $this->taxCategory->
build
() : $this->taxCategory,
660
$this->searchKeywords instanceof
SearchKeywordsBuilder
? $this->searchKeywords->
build
() : $this->searchKeywords,
661
$this->state instanceof
StateResourceIdentifierBuilder
? $this->state->
build
() : $this->state,
662
$this->publish,
663
$this->priceMode
664
);
665
}
666
667
public
static
function
of
():
ProductDraftBuilder
668
{
669
return
new
self
();
670
}
671
}
Commercetools\Api\Models\Category\CategoryResourceIdentifierCollection
Definition
CategoryResourceIdentifierCollection.php:22
Commercetools\Api\Models\Common\LocalizedStringBuilder
Definition
LocalizedStringBuilder.php:20
Commercetools\Api\Models\Common\LocalizedStringBuilder\build
build()
Definition
LocalizedStringBuilder.php:42
Commercetools\Api\Models\Product\CategoryOrderHintsBuilder
Definition
CategoryOrderHintsBuilder.php:20
Commercetools\Api\Models\Product\CategoryOrderHintsBuilder\build
build()
Definition
CategoryOrderHintsBuilder.php:42
Commercetools\Api\Models\Product\ProductDraftBuilder
Definition
ProductDraftBuilder.php:31
Commercetools\Api\Models\Product\ProductDraftBuilder\getMasterVariant
getMasterVariant()
Definition
ProductDraftBuilder.php:254
Commercetools\Api\Models\Product\ProductDraftBuilder\getCategories
getCategories()
Definition
ProductDraftBuilder.php:199
Commercetools\Api\Models\Product\ProductDraftBuilder\getState
getState()
Definition
ProductDraftBuilder.php:298
Commercetools\Api\Models\Product\ProductDraftBuilder\withDescription
withDescription(?LocalizedString $description)
Definition
ProductDraftBuilder.php:373
Commercetools\Api\Models\Product\ProductDraftBuilder\withCategoryOrderHints
withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
Definition
ProductDraftBuilder.php:395
Commercetools\Api\Models\Product\ProductDraftBuilder\withProductType
withProductType(?ProductTypeResourceIdentifier $productType)
Definition
ProductDraftBuilder.php:329
Commercetools\Api\Models\Product\ProductDraftBuilder\getKey
getKey()
Definition
ProductDraftBuilder.php:177
Commercetools\Api\Models\Product\ProductDraftBuilder\getPriceMode
getPriceMode()
Definition
ProductDraftBuilder.php:320
Commercetools\Api\Models\Product\ProductDraftBuilder\getName
getName()
Definition
ProductDraftBuilder.php:151
Commercetools\Api\Models\Product\ProductDraftBuilder\withMasterVariant
withMasterVariant(?ProductVariantDraft $masterVariant)
Definition
ProductDraftBuilder.php:439
Commercetools\Api\Models\Product\ProductDraftBuilder\withTaxCategory
withTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
Definition
ProductDraftBuilder.php:461
Commercetools\Api\Models\Product\ProductDraftBuilder\getMetaTitle
getMetaTitle()
Definition
ProductDraftBuilder.php:221
Commercetools\Api\Models\Product\ProductDraftBuilder\getDescription
getDescription()
Definition
ProductDraftBuilder.php:188
Commercetools\Api\Models\Product\ProductDraftBuilder\of
static of()
Definition
ProductDraftBuilder.php:667
Commercetools\Api\Models\Product\ProductDraftBuilder\withDescriptionBuilder
withDescriptionBuilder(?LocalizedStringBuilder $description)
Definition
ProductDraftBuilder.php:549
Commercetools\Api\Models\Product\ProductDraftBuilder\build
build()
Definition
ProductDraftBuilder.php:644
Commercetools\Api\Models\Product\ProductDraftBuilder\withMetaDescription
withMetaDescription(?LocalizedString $metaDescription)
Definition
ProductDraftBuilder.php:417
Commercetools\Api\Models\Product\ProductDraftBuilder\withMetaTitle
withMetaTitle(?LocalizedString $metaTitle)
Definition
ProductDraftBuilder.php:406
Commercetools\Api\Models\Product\ProductDraftBuilder\getVariants
getVariants()
Definition
ProductDraftBuilder.php:265
Commercetools\Api\Models\Product\ProductDraftBuilder\withTaxCategoryBuilder
withTaxCategoryBuilder(?TaxCategoryResourceIdentifierBuilder $taxCategory)
Definition
ProductDraftBuilder.php:615
Commercetools\Api\Models\Product\ProductDraftBuilder\withSearchKeywordsBuilder
withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
Definition
ProductDraftBuilder.php:626
Commercetools\Api\Models\Product\ProductDraftBuilder\withProductTypeBuilder
withProductTypeBuilder(?ProductTypeResourceIdentifierBuilder $productType)
Definition
ProductDraftBuilder.php:516
Commercetools\Api\Models\Product\ProductDraftBuilder\withVariants
withVariants(?ProductVariantDraftCollection $variants)
Definition
ProductDraftBuilder.php:450
Commercetools\Api\Models\Product\ProductDraftBuilder\withMetaTitleBuilder
withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
Definition
ProductDraftBuilder.php:571
Commercetools\Api\Models\Product\ProductDraftBuilder\getPublish
getPublish()
Definition
ProductDraftBuilder.php:309
Commercetools\Api\Models\Product\ProductDraftBuilder\getMetaDescription
getMetaDescription()
Definition
ProductDraftBuilder.php:232
Commercetools\Api\Models\Product\ProductDraftBuilder\getMetaKeywords
getMetaKeywords()
Definition
ProductDraftBuilder.php:243
Commercetools\Api\Models\Product\ProductDraftBuilder\getCategoryOrderHints
getCategoryOrderHints()
Definition
ProductDraftBuilder.php:210
Commercetools\Api\Models\Product\ProductDraftBuilder\withStateBuilder
withStateBuilder(?StateResourceIdentifierBuilder $state)
Definition
ProductDraftBuilder.php:637
Commercetools\Api\Models\Product\ProductDraftBuilder\withNameBuilder
withNameBuilder(?LocalizedStringBuilder $name)
Definition
ProductDraftBuilder.php:527
Commercetools\Api\Models\Product\ProductDraftBuilder\withMasterVariantBuilder
withMasterVariantBuilder(?ProductVariantDraftBuilder $masterVariant)
Definition
ProductDraftBuilder.php:604
Commercetools\Api\Models\Product\ProductDraftBuilder\withMetaKeywordsBuilder
withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
Definition
ProductDraftBuilder.php:593
Commercetools\Api\Models\Product\ProductDraftBuilder\withMetaDescriptionBuilder
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
Definition
ProductDraftBuilder.php:582
Commercetools\Api\Models\Product\ProductDraftBuilder\withSearchKeywords
withSearchKeywords(?SearchKeywords $searchKeywords)
Definition
ProductDraftBuilder.php:472
Commercetools\Api\Models\Product\ProductDraftBuilder\withKey
withKey(?string $key)
Definition
ProductDraftBuilder.php:362
Commercetools\Api\Models\Product\ProductDraftBuilder\withPriceMode
withPriceMode(?string $priceMode)
Definition
ProductDraftBuilder.php:505
Commercetools\Api\Models\Product\ProductDraftBuilder\withSlugBuilder
withSlugBuilder(?LocalizedStringBuilder $slug)
Definition
ProductDraftBuilder.php:538
Commercetools\Api\Models\Product\ProductDraftBuilder\withMetaKeywords
withMetaKeywords(?LocalizedString $metaKeywords)
Definition
ProductDraftBuilder.php:428
Commercetools\Api\Models\Product\ProductDraftBuilder\getSearchKeywords
getSearchKeywords()
Definition
ProductDraftBuilder.php:287
Commercetools\Api\Models\Product\ProductDraftBuilder\getTaxCategory
getTaxCategory()
Definition
ProductDraftBuilder.php:276
Commercetools\Api\Models\Product\ProductDraftBuilder\withSlug
withSlug(?LocalizedString $slug)
Definition
ProductDraftBuilder.php:351
Commercetools\Api\Models\Product\ProductDraftBuilder\withState
withState(?StateResourceIdentifier $state)
Definition
ProductDraftBuilder.php:483
Commercetools\Api\Models\Product\ProductDraftBuilder\withCategories
withCategories(?CategoryResourceIdentifierCollection $categories)
Definition
ProductDraftBuilder.php:384
Commercetools\Api\Models\Product\ProductDraftBuilder\getProductType
getProductType()
Definition
ProductDraftBuilder.php:140
Commercetools\Api\Models\Product\ProductDraftBuilder\withPublish
withPublish(?bool $publish)
Definition
ProductDraftBuilder.php:494
Commercetools\Api\Models\Product\ProductDraftBuilder\withName
withName(?LocalizedString $name)
Definition
ProductDraftBuilder.php:340
Commercetools\Api\Models\Product\ProductDraftBuilder\getSlug
getSlug()
Definition
ProductDraftBuilder.php:164
Commercetools\Api\Models\Product\ProductDraftBuilder\withCategoryOrderHintsBuilder
withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
Definition
ProductDraftBuilder.php:560
Commercetools\Api\Models\Product\ProductDraftModel
Definition
ProductDraftModel.php:30
Commercetools\Api\Models\Product\ProductVariantDraftBuilder
Definition
ProductVariantDraftBuilder.php:25
Commercetools\Api\Models\Product\ProductVariantDraftBuilder\build
build()
Definition
ProductVariantDraftBuilder.php:196
Commercetools\Api\Models\Product\ProductVariantDraftCollection
Definition
ProductVariantDraftCollection.php:22
Commercetools\Api\Models\Product\SearchKeywordsBuilder
Definition
SearchKeywordsBuilder.php:20
Commercetools\Api\Models\Product\SearchKeywordsBuilder\build
build()
Definition
SearchKeywordsBuilder.php:42
Commercetools\Api\Models\ProductType\ProductTypeResourceIdentifierBuilder
Definition
ProductTypeResourceIdentifierBuilder.php:24
Commercetools\Api\Models\ProductType\ProductTypeResourceIdentifierBuilder\build
build()
Definition
ProductTypeResourceIdentifierBuilder.php:82
Commercetools\Api\Models\State\StateResourceIdentifierBuilder
Definition
StateResourceIdentifierBuilder.php:24
Commercetools\Api\Models\State\StateResourceIdentifierBuilder\build
build()
Definition
StateResourceIdentifierBuilder.php:82
Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierBuilder
Definition
TaxCategoryResourceIdentifierBuilder.php:24
Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierBuilder\build
build()
Definition
TaxCategoryResourceIdentifierBuilder.php:82
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Common\LocalizedString
Definition
LocalizedString.php:14
Commercetools\Api\Models\Product\CategoryOrderHints
Definition
CategoryOrderHints.php:14
Commercetools\Api\Models\Product\ProductDraft
Definition
ProductDraft.php:20
Commercetools\Api\Models\Product\ProductVariantDraft
Definition
ProductVariantDraft.php:18
Commercetools\Api\Models\Product\SearchKeywords
Definition
SearchKeywords.php:14
Commercetools\Api\Models\ProductType\ProductTypeResourceIdentifier
Definition
ProductTypeResourceIdentifier.php:16
Commercetools\Api\Models\State\StateResourceIdentifier
Definition
StateResourceIdentifier.php:16
Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier
Definition
TaxCategoryResourceIdentifier.php:16
Commercetools\Base\Builder
Definition
Builder.php:16
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Product
Definition
AttributeAccessor.php:4
Generated by
1.9.8