mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Start updating the cart bundle docs
This commit is contained in:
parent
36ef752cf9
commit
15de1e49b5
1 changed files with 40 additions and 77 deletions
|
|
@ -1,64 +1,37 @@
|
||||||
SyliusCartBundle
|
SyliusCartBundle .. image:: http://travis-ci.org/Sylius/SyliusCartBundle.png
|
||||||
======================
|
================
|
||||||
|
|
||||||
Highly flexible cart engine.
|
A generic solution for building carts inside Symfony2 applications, it does not matter if you are
|
||||||
|
starting new project or you need to implement this feature for existing system - this bundle should be helpful.
|
||||||
|
Currently only the Doctrine ORM driver is implemented, so we'll use it here as example.
|
||||||
|
There are two main models inside the bundle, `Cart` and `CartItem`.
|
||||||
|
The second one will be the most interesting for us, as the cart is created as a quite sensible default.
|
||||||
|
Currently the bundle requires a bit of coding from you, but we're working on simplifying the adaption process.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Downloading the bundle
|
We assume you're familiar with `Composer <http://packagist.org>`_.
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
Add this to yours `composer.json`.
|
||||||
|
|
||||||
The good practice is to download it to `vendor/bundles/Sylius/Bundle/CartBundle`.
|
.. code-block:: json
|
||||||
|
|
||||||
This can be done in several ways, depending on your preference.
|
"require": {
|
||||||
|
"sylius/cart-bundle": "*"
|
||||||
|
},
|
||||||
|
|
||||||
The first method is the standard Symfony2 method.
|
And install it by typing following command.
|
||||||
|
|
||||||
Using the vendors script
|
|
||||||
************************
|
|
||||||
|
|
||||||
Add the following lines in your `deps` file. ::
|
|
||||||
|
|
||||||
[SyliusCartBundle]
|
|
||||||
git=git://github.com/Sylius/SyliusCartBundle.git
|
|
||||||
target=bundles/Sylius/Bundle/CartBundle
|
|
||||||
|
|
||||||
Now, run the vendors script to download the bundle.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ php bin/vendors install
|
$ php composer.phar update sylius/cart-bundle
|
||||||
|
|
||||||
Using submodules
|
Adding required bundles to kernel
|
||||||
****************
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
If you prefer instead to use git submodules, then run the following lines.
|
Now you need to enable the bundle inside kernel.
|
||||||
|
If you're not using any other Sylius bundles, you also need to add `SyliusResourceBundle` to kernel.
|
||||||
.. code-block:: bash
|
Do not worry, it was automatically installed for you by Composer.
|
||||||
|
|
||||||
$ git submodule add git://github.com/Sylius/SyliusCartBundle.git vendor/bundles/Sylius/Bundle/CartBundle
|
|
||||||
$ git submodule update --init
|
|
||||||
|
|
||||||
Autoloader configuration
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Add the `Sylius\\Bundle` namespace to your autoloader.
|
|
||||||
|
|
||||||
.. code-block:: php
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// app/autoload.php
|
|
||||||
|
|
||||||
$loader->registerNamespaces(array(
|
|
||||||
'Sylius\\Bundle' => __DIR__.'/../vendor/bundles'
|
|
||||||
));
|
|
||||||
|
|
||||||
Adding bundle to kernel
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Finally, enable the bundle in the kernel...
|
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
|
|
@ -70,20 +43,21 @@ Finally, enable the bundle in the kernel...
|
||||||
{
|
{
|
||||||
$bundles = array(
|
$bundles = array(
|
||||||
// ...
|
// ...
|
||||||
|
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
|
||||||
new Sylius\Bundle\CartBundle\SyliusCartBundle(),
|
new Sylius\Bundle\CartBundle\SyliusCartBundle(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Importing routing configuration
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
This part is not written yet.
|
|
||||||
|
|
||||||
Container configuration
|
Container configuration
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This part is not written yet.
|
||||||
|
|
||||||
|
Importing routing configuration
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
This part is not written yet.
|
This part is not written yet.
|
||||||
|
|
@ -91,14 +65,16 @@ Container configuration
|
||||||
Updating database schema
|
Updating database schema
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
The last thing you need to do is updating the database schema.
|
The last thing you need to do is to update the database schema.
|
||||||
|
|
||||||
For "**ORM**" driver run the following command.
|
For "**doctrine/orm**" driver run the following command.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ php app/console doctrine:schema:update --force
|
$ php app/console doctrine:schema:update --force
|
||||||
|
|
||||||
|
This should be done only in dev environment, we recommend using Doctrine migrations, to safely update your schema.
|
||||||
|
|
||||||
Usage guide
|
Usage guide
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|
@ -113,32 +89,19 @@ Configuration reference
|
||||||
|
|
||||||
This part is not written yet.
|
This part is not written yet.
|
||||||
|
|
||||||
Testing and continous integration
|
`phpspec2 <http://phpspec.net>`_ Specifications
|
||||||
----------------------------------
|
-----------------------------------------------
|
||||||
|
|
||||||
.. image:: http://travis-ci.org/Sylius/SyliusCartBundle.png
|
.. code-block:: bash
|
||||||
|
|
||||||
This bundle uses `travis-ci.org <http://travis-ci.org/Sylius/SyliusCartBundle>`_ for CI.
|
|
||||||
|
|
||||||
Before running tests, load the dependencies using `Composer <http://packagist.org>`_.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ wget http://getcomposer.org/composer.phar
|
$ wget http://getcomposer.org/composer.phar
|
||||||
$ php composer.phar install
|
$ php composer.phar install --dev
|
||||||
|
$ php bin/phpspec run
|
||||||
Now you can test by simply using this command.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ phpunit
|
|
||||||
|
|
||||||
Working examples
|
Working examples
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
If you want to see this and other bundles in action, try out the `Sylius sandbox application <http://github.com/Sylius/Sylius-Sandbox>`_.
|
If you want to see working implementation, try out the `Sylius sandbox application <http://github.com/Sylius/Sylius-Sandbox>`_.
|
||||||
|
|
||||||
It's open sourced github project.
|
|
||||||
|
|
||||||
Bug tracking
|
Bug tracking
|
||||||
------------
|
------------
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue