Implement Sylius into Symfony2 Standard Edition - symfony

Hoi,
I am trying to implement the Sylius e-commerce bundles into a fresh Symfony 2.2.2 Standard Edition.
When running the sylius:install command from commandline, i keep getting the following error:
The class 'Sylius\Bundle\CartBundle\Model\CartItemInterface' was not found in
the chain configured namespaces Sylius\Bundle\CoreBundle\Entity,
Sylius\Bundle\SettingsBundle\Entity, Sylius\Bundle\CartBundle\Entity,
Sylius\Bundle\AssortmentBundle\Entity, Sylius\Bundle\TaxationBundle\Entity,
Sylius\Bundle\ShippingBundle\Entity, Sylius\Bundle\PaymentsBundle\Entity,
Sylius\Bundle\PromotionsBundle\Entity, Sylius\Bundle\AddressingBundle\Entity,
Sylius\Bundle\SalesBundle\Entity, Sylius\Bundle\InventoryBundle\Entity,
Sylius\Bundle\TaxonomiesBundle\Entity, FOS\UserBundle\Entity
The Bundles are imported via Composer, activated via AppKernel.php, I've migrated the dependencies and configuration from a plain Sylius installation and actually have no idea, where this error comes from. I just noticed, that its trying to find a Model inside an Entiy-Namespace, which can't be right.
Anyone an idea?

We had the same problem, we are working with symfony 2.1. I fixed it by reordering the bundles registration in the app Kernel.php file.
In this file I placed the syliusCart bundle register before all the other sylius bundles and the doctrine registers.
I really dont know what is causing this or why this worked for me... but I hope this works for you.
Cheers!

Related

AppKernel.php not found on Symphony 5.3.7?

I tried to follow the following tutorial https://bitgandtter.wordpress.com/2015/09/10/symfony-a-restful-app-security-fosoauthserverbundle/ to install OAUTH2 on symfony.
Nevertheless, there is no more an AppKernel.php file (everything works very well with the server).
I think that this file has been renamed to Kernel.php, but with this new versions I can't follow the tutorial (write new FOS\OAuthServerBundle\FOSOAuthServerBundle() inside).
So, is this step is no more needed with newers versions of symfony or I have to do something else?
Check your config folder: there should be a bundles.php that also contains references to the other bundles you've installed.
But as the repository for FOSOAuthServerBundle hasn't seen that many commits in the last months, you should probably use any other OAuth bundle like knpuniversity/oauth2-client-bundle or hwi/oauth-bundle instead

How can I get the version of a bundle installed by Composer in Symfony?

We have multiple vendor bundles (both external and internally written) that are installed into Symfony via Composer. So an example from composer.json of one would be:
"repoName/ThisBundle" : "dev-release/1.1.2"
So in the controller in Symfony, how could I request the version of "ThisBundle" or "repoName/ThisBundle" to return "dev-release/1.1.2"?
One of the bundles serves a template to all our apps, and in one of the apps I want to display the template version being used.
you just type
composer.phar show
Will show all the currently installed packages and their version information.
To see more details, specify the name of the package as well:
composer.phar show bundle/bundlename
That will show many things, including commit MD5 hash, source URL, license type, etc.
If you have container object available (and it is the case if you're in a controller) then you can get array of the enabled bundles by
$this->container->getParameter('kernel.bundles');
but remember, just the enabled bundle in the appkernal.php
good luck

Sylius eCommerce installation in existing project

I have successfully installed SyliusCartBundle and "add-to-cart" functionality is working fine on product page. So for next process checkout page I need SyliusWebBundle as mentioned in https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/WebBundle/Resources/views/Frontend/Cart/summary.html.twig
So I installed SyliusWebBundle through composer and When I configured SyliusWebBundle in Appkernel.php then I got this error -
ServiceNotFoundException in CheckExceptionOnInvalidReferenceBehaviorPass.php line 58:
The service "sylius.menu_builder.frontend" has a dependency on a non-existent service "sylius.authorization_checker".
I am installing this bundles in my existing project for online Buy Option.
Or
Is it not possible to install SyliusWebBundle and other's SyliusBundle in Symfony 2+ Existing project ?
And Please also help me which sylius bundles required for creating a eCommerce system in existing project.
And I am also using Symfony2.6 + SonataAdminBundles
Any Help Will be highly Appreciated !
Thanks !
sylius.authorization_checker is defined in SyliusRbacBundle. Since it is required by SyliusCoreBundle and SyliusCoreBundle is required by SyliusWebBundle all you need to do is enable it in kernel:
new \Sylius\Bundle\RbacBundle\SyliusRbacBundle()
Then configure it.
Check docs for more details.

Installing sfGuard without changing db

I am to integrate sfGuard plugin with existing application. What I want to do is to keep as much code as possible untouched. Any guides? It'd be perfect if I can use actual database schema, or bind it somehow to be used by sfGuard. I know about setting userProfile class but I'm not sure how should I get to it, not to destroy my app.
Greetings
Just install plugin. And try make migrations. doctrine::generate-migrations-diff
php symfony doctrine:generate-migrations-diff
And migrate php symfony doctrine:migrate :
php symfony doctrine:migrate
Check out question: Rebuild model without loss data in MySQL for Symfony

Doctrine uploadable extension in Symfony

I read this doc in order to understand how the doctrine uploadable extension works so I can use it in my Symfony projects.
The problem is at the usage example, where I see an object called $listener and I really can not figure out where does it come from.
I intend to use a similar piece of code in one of my controllers, but I don't know to instantiate that listener, or where to grab it from.
If you look into the github project in question, you can see that they have a documentation in how to install and use them with symfony 2:
Install Gedmo Doctrine2 extensions in Symfony2
And if you don't want to do the hard work, there is also a pre-made bundle:
Integration bundle for DoctrineExtensions by l3pp4rd in Symfony2 (documentation)
Please note that while the bundle should be easier to install, it is made by a third party, not by the extensions developer, and it might not be as up to date.

Resources