bestit / commercetools-custom-types-bundle
Bundle to help you with the creation of custom types.
Installs: 39 297
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 4
Requires
- php: ^7.0 || ^8.0
- commercetools/php-sdk: ^1.4 || ^2.0
- symfony/config: ^3.1 || ^4.0 || ^5.0
- symfony/console: ^3.1 || ^4.0 || ^5.0
- symfony/dependency-injection: ^3.1 || ^4.0 || ^5.0
- symfony/http-kernel: ^3.1 || ^4.0 || ^5.0
- symfony/yaml: ^3.1 || ^4.0 || ^5.0
Requires (Dev)
- phpunit/phpunit: ^5.4
- squizlabs/php_codesniffer: ^2.7
- symfony/phpunit-bridge: ^3.0
This package is auto-updated.
Last update: 2024-12-19 22:41:44 UTC
README
Bundle to help you with the creation of custom types. It provides you with a symfony config param matching your custom type structure, which then is mirrored to your commercetools project.
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require bestit/commercetools-custom-types-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new BestIt\CTCustomTypesBundle\BestItCTCustomTypesBundle(), ); // ... } // ... }
Step 3: Configure
# Default configuration for extension with alias: "best_it_ct_custom_types" best_it_ct_custom_types: # Add the types mainly documented under: <https://dev.commercetools.com/http-api-projects-types.html> types: # Prototype key: name: # Required # Prototype lang: ~ description: # Required # Prototype lang: ~ # https://dev.commercetools.com/http-api-projects-custom-fields.html#customizable-resources resourceTypeIds: [] # Required # http://dev.commercetools.com/http-api-projects-types.html#fielddefinition fieldDefinitions: # Required # Prototype name: type: # Required name: ~ # One of "Boolean"; "String"; "LocalizedString"; "Enum"; "Number"; "Money"; "Date"; "T ime"; "DateTime"; "Set", Required # Specially used to the set type: <http://dev.commercetools.com/http-api-projects-types.html#settype> elementType: name: ~ # One of "Boolean"; "String"; "LocalizedString"; "Enum"; "Number"; "Money"; "Date" ; "Time"; "DateTime"; "Set", Required values: # Prototype key: ~ values: # Prototype key: ~ required: false # Required inputHint: ~ # One of "MultiLine"; "SingleLine", Required label: # Required # Prototype lang: ~ # The shell command works on the complete set of types normally. To prevent side effects while changing or deleting types which ar e "unknown at this moment" define a whitelist for types, on which you are allowed to work on. whitelist: [] commercetools_client_service: ~ # Required
Usage
The following symfony command mirrors your types config to the commercetools database:
$ php bin/console commercetools:process-custom-types [<whitelist>]
It tries to delete every custom type, which is not declared in your config or excluded by the whitelist (config or pcre regex without delimiter).
Further Todos
- Add unittests
- Refactor the command
- better Support for complex tyes