AppKernel.php not found on Symphony 5.3.7? - symfony

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

Related

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

Equivalent of Laravel Seeders on Symfony?

I'm developing a web site with Symfony. I'm new on this framework. Before i used Laravel 5.0 and I need to have a database with rows.
I create my db with command prompt but now I don't find how to seed it.
There is a equivalent of Laravel seeders on Symfony?
No. Seeding was a feature added by Laravel. You’ll need to use a third-party package to load seeds/fixtures into your application: http://www.sitepoint.com/data-fixtures-symfony2/
All the answers here are a bit outdated and this question is the first result on google so for future readers:
Since Symfony 3 there is an official bundle for this very purpose
Installation: composer require --dev doctrine/doctrine-fixtures-bundle
Then write your fixtures in src/DataFixtures and run php bin/console doctrine:fixtures:load
Try this package https://packagist.org/packages/evotodi/seed-bundle. Looks like it's what you need.
Their readme
Symfony/Doctrine Seed Bundle
Used to load/unload seed data from the database. Example would be to load a table with a list of states and abbreviations, or populate the users table with initial admin user(s). Unlike the DoctrineFixturesBundle which is mainly for development this bundle is for seeding the database before the initial push to production.

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.

Implement Sylius into Symfony2 Standard Edition

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!

Deleting not needed bundles from Symfony 2?

Is possible to delete bundles not needed in order to keep the project clean? I'm using Symfony2 with propel to build a RESTful interface. Don't need:
Twig
Doctrine2 (i prefer Propel instead)
Assetic (without Twig assetic does not make sense, correct me if i'm wrong)
Security (no need to model roles)
I can't find any how-to in order to remove uneeded bundles. Any help is much appreciated.
EDIT: monlog is the logger, not mongodb. Need it!
About deps.lock file: it can be removed after removing bundles, than issue:
php bin/vendors update
and i should be recreated. It maintains the git version id checked out, for each bundle.
Sure. Remove them from AppKernel then delete from the file system if you want. You could even edit the deps file to keep them from coming back. Twig and Assetic are independent. You could use the Assetic bundle with straight PHP.
In case anyone else runs into this issue, you can follow the instructions in the Symfony2 docs to remove the Acme Bundle: http://symfony.com/doc/2.0/cookbook/bundles/remove.html
The proccess is like this:
delete /src/Test/BlogBundle directory
change /app/config/routing.yml file to remove the bundle routes
Unregister your bundle from /app/AppKernel.php
clear cache (either by deleting cache/{$env} or console cache:clear)

Resources