Sylius: Feedback doc ProductBundle

Created on 29 Mar 2017  Â·  8Comments  Â·  Source: Sylius/Sylius

Just installed a fresh brand new Symfony 3.2 to test the ProductBundle installation guide : http://docs.sylius.org/en/latest/bundles/SyliusProductBundle/installation.html
Here is my feedback.

  1. You should update the documentation to advice developers to use the dev-master branch with composer by this way
    composer require sylius/produc-bundle dev-master
    or in composer.json, add or update the 2 fields in bold :
{
    "name" : "thomas/ecommerce",
    "license" : "proprietary",
    "type" : "project",
    **"minimum-stability" : "dev",
    "prefer-stable" : true,**

Otherwise the stable version 0.19 is installed instead, unusable and not supported anymore.

  1. Then, exception during doctrine:schema:update :
thomas@debian /var/www/ecommerce $ php bin/console doctrine:schema:update --force


  [Symfony\Component\Debug\Exception\ContextErrorException]                                                                           
  Warning: class_implements(): Class Sylius\Component\Product\Model\ProductVariantTranslation does not exist and could not be loaded
Documentation Stale

Most helpful comment

<?php
namespace AppBundle\DependencyInjection\Compiler;


use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class OverrideServiceCompilerPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        $definition = $container->getDefinition("sylius.context.locale.composite");
        $definition->setDecoratedService(null);
    }
}
<?php
namespace AppBundle;

use AppBundle\DependencyInjection\Compiler\OverrideServiceCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class AppBundle extends Bundle
{
    public function build(ContainerBuilder $container)
    {
        parent::build($container); // TODO: Change the autogenerated stub
        $container->addCompilerPass(new OverrideServiceCompilerPass());
    }

All 8 comments

Hi @tvequaud :) Thanks for your feedback, although... it is not an issue.

Since the docs are prepared and written (kind of upfront) for the oncoming stable release, then they assume that you are using the latest version available. Which is dev-master indeed.

@TheMadeleine : I knew you'll answer that :p it's not obvious for a beginner. And symfony is delivered in stable so by default newcomers will have a bad first impression (like I had). Even if it's only for few days/weeks.

Anyway I'm using the dev-master branch and got the exception in the second point.

We'll discuss the version mentioning problem at Sylius today, I promise :)

Regarding the exception you've got - did you check if the class exists in the project? Cleared the cache? If your project is clear, maybe recreating the database will help.

I finally had to force the update of all sylius/* packages in dev-master too : composer update sylius/*

but got another issue :

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]                                                     
  The service "sylius.form.type.product_attribute_value" has a dependency on a non-existent service "sylius.repository.locale"

I fixed this issue by installing LocaleBundle :
thomas@debian> composer require sylius/locale-bundle dev-master

and in AppKernel.php, I added the line in bold :

new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new winzou\Bundle\StateMachineBundle\winzouStateMachineBundle(),
**new Sylius\Bundle\LocaleBundle\SyliusLocaleBundle(),**
new Sylius\Bundle\ProductBundle\SyliusProductBundle(),
new Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),

And youhouu now it works !

thomas@debian /var/www/ecommerce $ php bin/console doctrine:schema:update --force
Updating database schema...
Database schema updated successfully! "36" queries were executed

[edit]
Sorry @TheMadeleine it doesn't in front :'(

LocaleNotFoundException in CompositeLocaleContext.php line 56:
Locale could not be found!

capture du 2017-03-29 14-04-35

I already submitted this bug in https://github.com/Sylius/Sylius/issues/7845
[/edit]

@TheMadeleine @pjedrzejewski
I have exactly the same error while upgrading a project which uses several sylius bundles into sylius beta 1.
LocaleNotFoundException in CompositeLocaleContext.php line 52:

There is no items on localeContexts property of CompositeLocaleContext

capture d ecran 2017-04-11 a 17 07 01

<?php
namespace AppBundle\DependencyInjection\Compiler;


use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class OverrideServiceCompilerPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        $definition = $container->getDefinition("sylius.context.locale.composite");
        $definition->setDecoratedService(null);
    }
}
<?php
namespace AppBundle;

use AppBundle\DependencyInjection\Compiler\OverrideServiceCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class AppBundle extends Bundle
{
    public function build(ContainerBuilder $container)
    {
        parent::build($container); // TODO: Change the autogenerated stub
        $container->addCompilerPass(new OverrideServiceCompilerPass());
    }

@chamss19 it works and it's far better than my "temporary" fix.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

javiereguiluz picture javiereguiluz  Â·  3Comments

ping86 picture ping86  Â·  3Comments

eb22fbb4 picture eb22fbb4  Â·  3Comments

crbelaus picture crbelaus  Â·  3Comments

reyostallenberg picture reyostallenberg  Â·  3Comments