Developed with love by KnpLabs Hire us for your project!
78

SyliusFlowBundle

by Sylius

Multi step setups, suitable for building checkouts & installations or whatever needs more than one action to work.

SyliusFlowBundle Build status...

Multiple action processes with reusable steps for Symfony2 applications.
Suitable for building checkouts or installations.

Note: This bundle is a prototype, it works only with latest Symfony.

Sylius

Sylius, webshop engine for Symfony2.

<?php

namespace Acme\Bundle\CheckoutBundle\Process\Scenario;

use Acme\Bundle\CheckoutBundle\Process\Step;
use Sylius\Bundle\FlowBundle\Process\Builder\ProcessBuilderInterface;
use Sylius\Bundle\FlowBundle\Process\Scenario\ProcessScenarioInterface;

/**
 * My super checkout.
 *
 * @author Potato Potato <potato@potato.foo>
 */
class CheckoutScenario implements ProcessScenarioInterface
{
    /**
     * {@inheritdoc}
     */
    public function build(ProcessBuilderInterface $builder)
    {
        $builder
            ->add('security', new Step\SecurityStep())
            ->add('delivery', new Step\DeliveryStep())
            ->add('billing', 'acme_checkout_step_billing')
            ->add('finalize', new Step\FinalizeStep())
        ;
    }
}
<?php

namespace Acme\Bundle\CheckoutBundle\Process\Step;

use Acme\Bundle\CheckoutBundle\Entity\Address;
use Sylius\Bundle\FlowBundle\Process\Context\ProcessContextInterface;
use Sylius\Bundle\FlowBundle\Process\Step\ContainerAwareStep;

/**
 * Delivery step.
 * Allows user to select delivery method for order.
 *
 * @author Potato Potato <potato@potato.foo>
 */
class DeliveryStep extends ContainerAwareStep
{
    /**
     * {@inheritdoc}
     */
    public function displayAction(ProcessContextInterface $context)
    {
        // All data is stored in a separate session bag with parameter namespace support.
        $address = $context->getStorage()->get('delivery.address');
        $form = $this->createAddressForm($address);

        return $this->container->get('templating')->renderResponse('AcmeCheckoutBundle:Step:delivery.html.twig', array(
            'form'    => $form->createView(),
            'context' => $context
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function forwardAction(ProcessContextInterface $context)
    {
        $request = $context->getRequest();
        $form = $this->createAddressForm();

        if ($request->isMethod('POST') && $form->bindRequest($request)->isValid()) {
            $context->getStorage()->set('delivery.address', $form->getData());
            $context->complete(); // Complete step, user will be redirected to next step.

            return;
        }

        // Form was not valid so we display the form again.
        return $this->container->get('templating')->renderResponse('AcmeCheckoutBundle:Step:delivery.html.twig', array(
            'form'    => $form->createView(),
            'context' => $context
        ));
    }

    /**
     * Create address form.
     *
     * @param Address $address
     *
     * @return FormInterface
     */
    private function createAddressForm(Address $address = null)
    {
        return $this->container->get('form.factory')->create('acme_checkout_address', $address);
    }
}

Sylius

Sylius is simple but end-user and developer friendly webshop engine built on top of Symfony2.

Please visit Sylius.org for more details.

Testing and build status

This bundle uses travis-ci.org for CI.
Build status...

Before running tests, load the dependencies using Composer.

$ wget http://getcomposer.org/composer.phar
$ php composer.phar install --dev

Now you can run the tests by simply using this command.

$ phpunit

Documentation

Documentation is available on docs.sylius.org.

Code examples

If you want to see working implementation, try out the Sylius sandbox application.

Contributing

All informations about contributing to Sylius can be found on this page.

Mailing lists

Questions? Feel free to ask on users mailing list.
To contribute and develop this bundle, use the developers mailing list.

Sylius twitter account

If you want to keep up with updates, follow the official Sylius account on twitter.

Bug tracking

This bundle uses GitHub issues.
If you have found bug, please create an issue.

Versioning

Releases will be numbered with the format major.minor.patch.

And constructed with the following guidelines.

  • Breaking backwards compatibility bumps the major.
  • New additions without breaking backwards compatibility bumps the minor.
  • Bug fixes and misc changes bump the patch.

For more information on SemVer, please visit semver.org website.

This versioning method is same for all Sylius bundles and applications.

License

License can be found here.

Authors

The bundle was originally created by Paweł Jędrzejewski.
See the list of contributors.

Copyright (c) 2011-2012 Paweł Jędrzejewski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
sylius:
storage: sylius.process_storage.session
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago
  • Merge pull request #22 from umpirsky/fix/doc-inspired-improvements
    By pjedrzejewski, 1 month ago