From c97c316efb8c63d765825f243f2976a020b1a9b0 Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Mon, 12 Sep 2016 15:57:33 +0200 Subject: [PATCH] [Variation] Remove documentation --- .../SyliusVariationBundle/configuration.rst | 56 ----- docs/bundles/SyliusVariationBundle/index.rst | 15 -- .../SyliusVariationBundle/installation.rst | 86 ------- docs/bundles/index.rst | 1 - docs/bundles/map.rst.inc | 1 - docs/components/Product/basic_usage.rst | 5 - docs/components/Product/interfaces.rst | 10 +- docs/components/Product/models.rst | 3 +- docs/components/Variation/basic_usage.rst | 222 ------------------ docs/components/Variation/index.rst | 12 - docs/components/Variation/installation.rst | 11 - docs/components/Variation/interfaces.rst | 106 --------- docs/components/Variation/models.rst | 112 --------- docs/components/index.rst | 1 - docs/components/map.rst.inc | 1 - 15 files changed, 2 insertions(+), 640 deletions(-) delete mode 100644 docs/bundles/SyliusVariationBundle/configuration.rst delete mode 100644 docs/bundles/SyliusVariationBundle/index.rst delete mode 100644 docs/bundles/SyliusVariationBundle/installation.rst delete mode 100644 docs/components/Variation/basic_usage.rst delete mode 100644 docs/components/Variation/index.rst delete mode 100644 docs/components/Variation/installation.rst delete mode 100644 docs/components/Variation/interfaces.rst delete mode 100644 docs/components/Variation/models.rst diff --git a/docs/bundles/SyliusVariationBundle/configuration.rst b/docs/bundles/SyliusVariationBundle/configuration.rst deleted file mode 100644 index af3db1ea01..0000000000 --- a/docs/bundles/SyliusVariationBundle/configuration.rst +++ /dev/null @@ -1,56 +0,0 @@ -Configuration reference -======================= - -.. code-block:: yaml - - sylius_variation: - driver: ~ # The driver used for persistence layer. Currently only `doctrine/orm` is supported. - resources: - # `variation_name` can be any name, for example `product`, `ad`, or `blog_post` - variation_name: - variable: ~ # Required: The variable model class implementing `VariableInterface` - # of which variants can be created from - variant: - classes: - model: ~ # Required: The variant model class implementing `VariantInterface` - interface: ~ - controller: Sylius\Bundle\ResourceBundle\Controller\ResourceController - repository: ~ # Required: The repository class for the variant - factory: Sylius\Component\Resource\Factory\Factory - form: - default: Sylius\Bundle\VariationBundle\Form\Type\VariantType - validation_groups: - default: [ sylius ] - option: - classes: - model: ~ # Required: The option model class implementing `OptionInterface` - interface: ~ - repository: ~ # Required: The repository class for the option - controller: Sylius\Bundle\ResourceBundle\Controller\ResourceController - factory: Sylius\Component\Resource\Factory\Factory - form: - default: Sylius\Bundle\VariationBundle\Form\Type\OptionType - choice: - validation_groups: - default: [ sylius ] - translation: - classes: - model: Sylius\Component\Variation\Model\OptionTranslation - interface: Sylius\Component\Variation\Model\OptionTranslationInterface - controller: Sylius\Bundle\ResourceBundle\Controller\ResourceController - repository: ~ # Required: The repository class for the option - factory: Sylius\Component\Resource\Factory\Factory - form: - default: Sylius\Bundle\VariationBundle\Form\Type\OptionTranslationType - validation_groups: - default: [ sylius ] - fields: - default: [ presentation ] - option_value: - model: ~ # Required: The option value model class implementing `OptionValueInterface` - interface: ~ - controller: Sylius\Bundle\ResourceBundle\Controller\ResourceController - repository: ~ # Required: The repository class for the option value - factory: Sylius\Component\Resource\Factory\Factory - form: - default: Sylius\Bundle\VariationBundle\Form\Type\OptionValueType diff --git a/docs/bundles/SyliusVariationBundle/index.rst b/docs/bundles/SyliusVariationBundle/index.rst deleted file mode 100644 index 4d655c0709..0000000000 --- a/docs/bundles/SyliusVariationBundle/index.rst +++ /dev/null @@ -1,15 +0,0 @@ -SyliusVariationBundle -===================== - -This bundle allows you to manage and generate variations of any compatible object with a very flexible architecture. - -Sylius uses this bundle internally for its product catalog to manage variations of the same product based on its options -and their values, but can be used with almost any object. - - -.. toctree:: - :maxdepth: 1 - :numbered: - - installation - configuration diff --git a/docs/bundles/SyliusVariationBundle/installation.rst b/docs/bundles/SyliusVariationBundle/installation.rst deleted file mode 100644 index 6e1b083211..0000000000 --- a/docs/bundles/SyliusVariationBundle/installation.rst +++ /dev/null @@ -1,86 +0,0 @@ -Installation -============ - -We assume you're familiar with `Composer `_, a dependency manager for PHP. -Use the following command to add the bundle to your `composer.json` and download the package. - -If you have `Composer installed globally `_. - -.. code-block:: bash - - $ composer require sylius/variation-bundle - -Otherwise you have to download .phar file. - -.. code-block:: bash - - $ curl -sS https://getcomposer.org/installer | php - $ php composer.phar require sylius/variation-bundle - -Adding required bundles to the kernel -------------------------------------- - -You need to enable the bundle inside the kernel. - -If you're not using any other Sylius bundles, you will also need to add `SyliusResourceBundle` and its dependencies to kernel. -Don't worry, everything was automatically installed via Composer. - -.. code-block:: php - - setOptions($options); $product->hasOptions(); // Returns true. $product->getOptions(); // Returns an array containing all inserted options. - -.. note:: - Doesn't matter if you use **Option** objects from this component, - the :doc:`/components/Variation/index` or your custom. - Every model implementing the :ref:`component_variation_model_option-interface` is supported. diff --git a/docs/components/Product/interfaces.rst b/docs/components/Product/interfaces.rst index b99ed6a2dc..6536da00e3 100644 --- a/docs/components/Product/interfaces.rst +++ b/docs/components/Product/interfaces.rst @@ -54,12 +54,4 @@ to bind an attribute and a value to a specific product. VariantInterface ~~~~~~~~~~~~~~~~ -This interface should be implemented by models binding -a product with a specific combination of attributes. - -.. note:: - This interface extends the :ref:`component_variation_model_variant-interface`. - - For more information go to `Sylius API VariantInterface`_. - -.. _Sylius API VariantInterface: http://api.sylius.org/Sylius/Component/Product/Model/VariantInterface.html +This interface should be implemented by models binding a product with a specific combination of attributes. diff --git a/docs/components/Product/models.rst b/docs/components/Product/models.rst index dea09dbeb4..f721cd147c 100644 --- a/docs/components/Product/models.rst +++ b/docs/components/Product/models.rst @@ -100,8 +100,7 @@ and provides an additional property: +-------------+---------------------------------------------------------+ .. note:: - This model extends the :ref:`component_variation_model_variant` - and implements the :ref:`component_product_model_variant-interface`. + This model implements the :ref:`component_product_model_variant-interface`. For more detailed information go to `Sylius API Variant`_. diff --git a/docs/components/Variation/basic_usage.rst b/docs/components/Variation/basic_usage.rst deleted file mode 100644 index 3757ef736d..0000000000 --- a/docs/components/Variation/basic_usage.rst +++ /dev/null @@ -1,222 +0,0 @@ -Basic Usage -=========== - -VariableInterface ------------------ - -Let's see how an exemplary class implementing the **VariableInterface** should look like. - -.. code-block:: php - - name = $name; - $this->variants = new ArrayCollection(); - $this->options = new ArrayCollection(); - } - - /** - * {@inheritdoc} - */ - public function hasVariants() - { - return !$this->variants->isEmpty(); - } - - /** - * {@inheritdoc} - */ - public function getVariants() - { - return $this->variants; - } - - /** - * {@inheritdoc} - */ - public function setVariants(Collection $variants) - { - $this->variants = $variants; - } - - /** - * {@inheritdoc} - */ - public function addVariant(VariantInterface $variant) - { - $this->variants->add($variant); - } - - /** - * {@inheritdoc} - */ - public function removeVariant(VariantInterface $variant) - { - $this->variants->removeElement($variant); - } - - /** - * {@inheritdoc} - */ - public function hasVariant(VariantInterface $variant) - { - return $this->variants->contains($variant); - } - - /** - * {@inheritdoc} - */ - public function hasOptions() - { - return !$this->options->isEmpty(); - } - - /** - * {@inheritdoc} - */ - public function getOptions() - { - return $this->options; - } - - /** - * {@inheritdoc} - */ - public function setOptions(Collection $options) - { - $this->options = $options; - } - - /** - * {@inheritdoc} - */ - public function addOption(OptionInterface $option) - { - $this->options->add($option); - } - - /** - * {@inheritdoc} - */ - public function removeOption(OptionInterface $option) - { - $this->options->removeElement($option); - } - - /** - * {@inheritdoc} - */ - public function hasOption(OptionInterface $option) - { - return $this->options->contains($option); - } - } - -.. _component_variation_generator_variant-generator: - -VariantGenerator ----------------- - -A **VariantGenerator** is used to create all possible combinations of an object's options and to create ``Variant`` models from them. - -**Example:** - -If an object such as a T-shirt has 2 options - *Color* and *Size* - with 3 possible values per option, -then the generator will create 9 variants and assign them to the object. - -The generator will ignore invalid variants or variants that already exist. - -**T-Shirt Options** - -+------------+----------+ -| **Colors** | **Size** | -+------------+----------+ -| Black | Small | -+------------+----------+ -| White | Medium | -+------------+----------+ -| Red | Large | -+------------+----------+ - -**Possible T-Shirt Variants** - -These variants should be generated by the ``VariantGenerator`` from the options above: - -1. Black, Small -2. Black, Medium -3. Black, Large -4. White, Small -5. White, Medium -6. White, Large -7. Red, Small -8. Red, Medium -9. Red, Large - -.. code-block:: php - - setValues(new ArrayCollection(array('White', 'Black', 'Red'))); - $colors->setName('Color'); - - $sizes = new Option(); - $sizes->setValues(new ArrayCollection(array('Small', 'Medium', 'Large'))); - $sizes->setName('Size'); - - $variable->addOption($colors); - $variable->addOption($sizes); - - $generator = new VariantGenerator($variantRepository, $setBuilder); - - // Generate all possible variants if they don't exist yet. - $generator->generate($variable) - -.. note:: - - The variant generator implements the :ref:`component_variation_generator_variant-generator-interface`. - - -.. note:: - - The variant generator's set builder should implement the :ref:`component_variation_set-builder_set-builder-interface`. - diff --git a/docs/components/Variation/index.rst b/docs/components/Variation/index.rst deleted file mode 100644 index 58f3c0c130..0000000000 --- a/docs/components/Variation/index.rst +++ /dev/null @@ -1,12 +0,0 @@ -Variation -========= - -Library for managing object variants and options. This functionality can be attached to any object to create different configurations. - -.. toctree:: - :maxdepth: 2 - - installation - basic_usage - models - interfaces diff --git a/docs/components/Variation/installation.rst b/docs/components/Variation/installation.rst deleted file mode 100644 index ef45815460..0000000000 --- a/docs/components/Variation/installation.rst +++ /dev/null @@ -1,11 +0,0 @@ -Installation -============ - -You can install the component in 2 different ways: - -* :doc:`Install it via Composer ` (``sylius/variation`` on `Packagist`_); -* Use the official Git repository (https://github.com/Sylius/Variation). - -.. include:: /components/require_autoload.rst.inc - -.. _Packagist: https://packagist.org/packages/sylius/variation diff --git a/docs/components/Variation/interfaces.rst b/docs/components/Variation/interfaces.rst deleted file mode 100644 index f06089cb69..0000000000 --- a/docs/components/Variation/interfaces.rst +++ /dev/null @@ -1,106 +0,0 @@ -Interfaces -========== - -Model Interfaces ----------------- - -.. _component_variation_model_variable-interface: - -VariableInterface -~~~~~~~~~~~~~~~~~ - -In order for the object class to manage variants and options it has to implement the ``VariableInterface``. - -.. note:: - - You will find more information about this interface in `Sylius API VariableInterface`_. - -.. _Sylius API VariableInterface: http://api.sylius.org/Sylius/Component/Variation/Model/VariableInterface.html - -.. _component_variation_model_variant-interface: - -VariantInterface -~~~~~~~~~~~~~~~~ - -When an object class implements the ``VariantInterface`` it has a possibility to manage options. - -.. note:: - - This interface extends the :ref:`component_resource_model_timestampable-interface`. - - You will find more information about this interface in `Sylius API VariantInterface`_. - -.. _Sylius API VariantInterface: http://api.sylius.org/Sylius/Component/Variation/Model/VariantInterface.htm - -.. _component_variation_model_option-interface: - -OptionInterface -~~~~~~~~~~~~~~~ - -In order for an object class to represent the option type it has to implement the ``OptionInterface``. - -.. note:: - - This interface extends :ref:`component_resource_model_code-aware-interface`, :ref:`component_resource_model_timestampable-interface` - and the :ref:`component_variation_model_option-translation-interface`. - - You will find more information about this interface in `Sylius API OptionInterface`_. - -.. _Sylius API OptionInterface: http://api.sylius.org/Sylius/Component/Variation/Model/OptionInterface.html - -.. _component_variation_model_option-translation-interface: - -OptionTranslationInterface -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In order to store the translation of an **Option** an object class needs to imlement this interface. - -.. note:: - - You will find more information about this interface in `Sylius API OptionTranslationInterface`_. - -.. _Sylius API OptionTranslationInterface: http://api.sylius.org/Sylius/Component/Variation/Model/OptionTranslationInterface.html - -.. _component_variation_model_option-value-interface: - -OptionValueInterface -~~~~~~~~~~~~~~~~~~~~ - -If you need to store a value of an **Option** you will have to create an object class that implements this interface. - -.. note:: - - This interface extends :ref:`component_resource_model_code-aware-interface`. - - You will find more information about that interface in `Sylius API OptionValueInterface`_. - -.. _Sylius API OptionValueInterface: http://api.sylius.org/Sylius/Component/Variation/Model/OptionValueInterface.html - -Services Interfaces -------------------- - -.. _component_variation_set-builder_set-builder-interface: - -SetBuilderInterface -~~~~~~~~~~~~~~~~~~~ - -When you want a service to be able to Build a product set from one or more given sets it should implement the ``SetBuilderInterface``. - -.. note:: - - You will find more information about that interface in `Sylius API SetBuilderInterface`_. - -.. _Sylius API SetBuilderInterface: http://api.sylius.org/Sylius/Component/Variation/SetBuilder/SetBuilderInterface.html - -.. _component_variation_generator_variant-generator-interface: - -VariantGeneratorInterface -~~~~~~~~~~~~~~~~~~~~~~~~~ - -This interface is used to create all possible (non-existing) variations of a given object based on its options. - -.. note:: - - You will find more information about that interface in `Sylius API VariantGeneratorInterface`_. - -.. _Sylius API VariantGeneratorInterface: http://api.sylius.org/Sylius/Component/Variation/SetBuilder/VariantGeneratorInterface.html diff --git a/docs/components/Variation/models.rst b/docs/components/Variation/models.rst deleted file mode 100644 index c734e0edd1..0000000000 --- a/docs/components/Variation/models.rst +++ /dev/null @@ -1,112 +0,0 @@ -Models -====== - -.. _component_variation_model_variant: - -Variant -------- - -Every variant is represented by **Variant** instance and has the following properties: - -+--------------+---------------------------------------------+ -| Property | Description | -+==============+=============================================+ -| id | Unique id of the variant | -+--------------+---------------------------------------------+ -| presentation | Name displayed to user | -+--------------+---------------------------------------------+ -| object | Related product | -+--------------+---------------------------------------------+ -| options | Option values | -+--------------+---------------------------------------------+ -| createdAt | Date of creation | -+--------------+---------------------------------------------+ -| updatedAt | Date of the last update | -+--------------+---------------------------------------------+ - -.. note:: - - This model implements the :ref:`component_variation_model_variant-interface`. - You will find more information about this interface in `Sylius API Variant`_. - -.. _Sylius API Variant: http://api.sylius.org/Sylius/Component/Variation/Model/Variant.html - -.. _component_variation_model_option: - -Option ------- - -Every variant option is represented by **Option** instance and has the following properties: - -+--------------+---------------------------------------------+ -| Property | Description | -+==============+=============================================+ -| id | Unique id of the Option | -+--------------+---------------------------------------------+ -| code | Unique code of the Option | -+--------------+---------------------------------------------+ -| name | Internal name | -+--------------+---------------------------------------------+ -| presentation | Name displayed to user | -+--------------+---------------------------------------------+ -| values | Option values | -+--------------+---------------------------------------------+ -| createdAt | Date of creation | -+--------------+---------------------------------------------+ -| updatedAt | Date of the last update | -+--------------+---------------------------------------------+ - -.. note:: - - This model implements the :ref:`component_variation_model_option-interface`. - You will find more information about this interface in `Sylius API Option`_. - -.. _Sylius API Option: http://api.sylius.org/Sylius/Component/Variation/Model/Option.html - -.. _component_variation_model_option-translation: - -OptionTranslation ------------------ - -Every variant option has a corresponding translation stored as an **OptionTranslation** instance and has the following properties: - -+--------------+---------------------------------------------+ -| Property | Description | -+==============+=============================================+ -| id | Unique id of the translation | -+--------------+---------------------------------------------+ -| presentation | Translated option name | -+--------------+---------------------------------------------+ - -.. note:: - - This model implements the :ref:`component_variation_model_option-translation-interface`. - You will find more information about this interface in `Sylius API OptionTranslation`_. - -.. _Sylius API OptionTranslation: http://api.sylius.org/Sylius/Component/Variation/Model/OptionTranslation.html - -.. _component_variation_model_option_value: - -OptionValue ------------ - -Every variant option value is represented by **OptionValue** instance and has the following properties: - -+--------------+---------------------------------------------+ -| Property | Description | -+==============+=============================================+ -| id | Unique id of the OptionValue | -+--------------+---------------------------------------------+ -| code | Unique code of the OptionValue | -+--------------+---------------------------------------------+ -| value | Option internal value | -+--------------+---------------------------------------------+ -| option | An instance of Option | -+--------------+---------------------------------------------+ - -.. note:: - - This model implements the :ref:`component_variation_model_option-value-interface`. - You will find more information about this interface in `Sylius API OptionValue`_. - -.. _Sylius API OptionValue: http://api.sylius.org/Sylius/Component/Variation/Model/OptionValue.html diff --git a/docs/components/index.rst b/docs/components/index.rst index 70ef600dfa..9e49280b9f 100644 --- a/docs/components/index.rst +++ b/docs/components/index.rst @@ -34,6 +34,5 @@ We recommend checking out :doc:`/components/general/index`, which will get you s Taxation/index Taxonomy/index User/index - Variation/index .. include:: /components/map.rst.inc diff --git a/docs/components/map.rst.inc b/docs/components/map.rst.inc index c26c1e2a65..22132fb072 100644 --- a/docs/components/map.rst.inc +++ b/docs/components/map.rst.inc @@ -19,4 +19,3 @@ * :doc:`/components/Taxation/index` * :doc:`/components/Taxonomy/index` * :doc:`/components/User/index` -* :doc:`/components/Variation/index`