Composable Commerce PHP SDKPHP SDK
  • Namespace
  • Class
  • Tree

Namespaces

  • Commercetools
    • Commons
      • Helper
    • Core
      • Builder
        • Request
        • Update
      • Cache
      • Client
        • Adapter
        • OAuth
      • Error
      • Helper
        • Annotate
        • State
          • Renderer
        • Subscriber
          • Log
      • Model
        • ApiClient
        • Cart
        • CartDiscount
        • Category
        • Channel
        • Common
        • Customer
        • CustomerGroup
        • CustomField
        • CustomObject
        • DiscountCode
        • Extension
        • Inventory
        • Message
        • Order
        • OrderEdit
        • Payment
        • Product
          • Search
        • ProductDiscount
        • ProductSelection
        • ProductType
        • Project
        • Review
        • ShippingMethod
        • ShoppingList
        • State
        • Store
        • Subscription
        • TaxCategory
        • Type
        • Zone
      • Request
        • ApiClients
        • CartDiscounts
          • Command
        • Carts
          • Command
        • Categories
          • Command
        • Channels
          • Command
        • CustomerGroups
          • Command
        • Customers
          • Command
        • CustomField
          • Command
        • CustomObjects
        • DiscountCodes
          • Command
        • Extensions
          • Command
        • GraphQL
        • InStores
        • Inventory
          • Command
        • Me
          • Command
        • Messages
        • OrderEdits
          • Command
          • StagedOrder
            • Command
        • Orders
          • Command
        • Payments
          • Command
        • ProductDiscounts
          • Command
        • Products
          • Command
        • ProductSelections
          • Command
        • ProductTypes
          • Command
        • Project
          • Command
        • Query
        • Reviews
          • Command
        • ShippingMethods
          • Command
        • ShoppingLists
          • Command
        • States
          • Command
        • Stores
          • Command
        • Subscriptions
          • Command
        • TaxCategories
          • Command
        • Types
          • Command
        • Zones
          • Command
      • Response

Classes

  • Customer
  • CustomerCollection
  • CustomerDraft
  • CustomerReference
  • CustomerSigninResult
  • CustomerToken
  • MyCustomerDraft
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 
<?php
/**
 * @author @jenschude <jens.schulze@commercetools.de>
 * @created: 11.02.15, 14:23
 */

namespace Commercetools\Core\Model\Customer;

use Commercetools\Core\Model\Common\Context;
use Commercetools\Core\Model\Common\JsonObject;
use Commercetools\Core\Model\Common\DateTimeDecorator;
use Commercetools\Core\Model\Common\LocaleTrait;
use Commercetools\Core\Model\CustomerGroup\CustomerGroupReference;
use Commercetools\Core\Model\Common\AddressCollection;
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft;
use Commercetools\Core\Model\Common\DateDecorator;
use DateTime;

/**
 * @package Commercetools\Core\Model\Customer
 * @link https://docs.commercetools.com/http-api-projects-me-profile.html#mycustomerdraft
 * @method string getEmail()
 * @method MyCustomerDraft setEmail(string $email = null)
 * @method string getPassword()
 * @method MyCustomerDraft setPassword(string $password = null)
 * @method string getFirstName()
 * @method MyCustomerDraft setFirstName(string $firstName = null)
 * @method string getMiddleName()
 * @method MyCustomerDraft setMiddleName(string $middleName = null)
 * @method string getLastName()
 * @method MyCustomerDraft setLastName(string $lastName = null)
 * @method string getTitle()
 * @method MyCustomerDraft setTitle(string $title = null)
 * @method DateDecorator getDateOfBirth()
 * @method MyCustomerDraft setDateOfBirth(DateTime $dateOfBirth = null)
 * @method string getCompanyName()
 * @method MyCustomerDraft setCompanyName(string $companyName = null)
 * @method string getVatId()
 * @method MyCustomerDraft setVatId(string $vatId = null)
 * @method AddressCollection getAddresses()
 * @method MyCustomerDraft setAddresses(AddressCollection $addresses = null)
 * @method int getDefaultShippingAddress()
 * @method MyCustomerDraft setDefaultShippingAddress(int $defaultShippingAddress = null)
 * @method int getDefaultBillingAddress()
 * @method MyCustomerDraft setDefaultBillingAddress(int $defaultBillingAddress = null)
 * @method CustomFieldObjectDraft getCustom()
 * @method MyCustomerDraft setCustom(CustomFieldObjectDraft $custom = null)
 * @method string getLocale()
 */
class MyCustomerDraft extends JsonObject
{
    use LocaleTrait;

    public function fieldDefinitions()
    {
        return [
            'email' => [static::TYPE => 'string'],
            'password' => [static::TYPE => 'string'],
            'firstName' => [static::TYPE => 'string', static::OPTIONAL => true],
            'middleName' => [static::TYPE => 'string', static::OPTIONAL => true],
            'lastName' => [static::TYPE => 'string', static::OPTIONAL => true],
            'title' => [static::TYPE => 'string', static::OPTIONAL => true],
            'dateOfBirth' => [
                static::TYPE => DateTime::class,
                static::OPTIONAL => true,
                static::DECORATOR => DateDecorator::class
            ],
            'companyName' => [static::TYPE => 'string', static::OPTIONAL => true],
            'vatId' => [static::TYPE => 'string', static::OPTIONAL => true],
            'addresses' => [static::TYPE => AddressCollection::class, static::OPTIONAL => true],
            'defaultShippingAddress' => [static::TYPE => 'int', static::OPTIONAL => true],
            'defaultBillingAddress' => [static::TYPE => 'int', static::OPTIONAL => true],
            'custom' => [static::TYPE => CustomFieldObjectDraft::class, static::OPTIONAL => true],
            'locale' => [static::TYPE => 'string', static::OPTIONAL => true],
        ];
    }

    /**
     * @param string $email
     * @param string $firstName
     * @param string $lastName
     * @param string $password
     * @param Context|callable $context
     * @return MyCustomerDraft
     */
    public static function ofEmailNameAndPassword($email, $firstName, $lastName, $password, $context = null)
    {
        $draft = static::of($context);
        return $draft->setEmail($email)
            ->setFirstName($firstName)
            ->setLastName($lastName)
            ->setPassword($password);
    }
}
PHP SDK API documentation generated by ApiGen