Deleting not needed bundles from Symfony 2? - symfony

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)

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

Map an entity in symfony 4

How about, I have a problem and it is before in symfony3 was run in the console:
php bin/console doctrine:mapping:import MiBundle yml
and generated and map an entity of the database but in Symfony 4 the command in the console is always the same, but the bundles are no longer occupied in the latest version so the previous command as it is does not work anymore, Someone could help me...
likewise generate the get and set
When using the new Symfony 4 directory structure without bundles the commands for importing the mapping and creating entities from an existing schema in the DoctrineBundle will no longer work properly. There is currently an ongoing discussion whether to update them, but the Doctrine team considers those tools counterproductive. You are not meant to blindly map the schema 1:1 to your domain model.
The best advice I can give for now is to temporarily create a bundle and then move the resulting files. This is also the workaround suggested in the github-issue regarding this: https://github.com/doctrine/DoctrineBundle/issues/729
The Symfony team is moving some of those commands into their own MakeBundle, but I don't think this command is already in there. Maybe you want to follow their progress.

Symfony bundle scaffolding with subfolders

According to this well-known article:
https://blog.liip.ch/archive/2011/05/19/symfony2-bundle-structure-a-use-case.html
Is there a fast way to scaffold a bundle with Frontend and Backend subfolders?
I haven't heard of something like that. And I don't see any advantage of it.
This also means I don't think you should have both backend and frontend in the same bundle. Id avise you to make two seperate bundles.
Project\Something\BackendBundle
Project\Something\FrontendBundle
You can do that using app/console generate:bundle
This will result in a Project/Something folder structure with both bundles in the same Something folder.

How to register simple things entity Audit extension in symfony2

I am trying to use simple things entity audit bundle in my application, but couldnt figure out the way to get this right. Please find the steps i am trying below,
1) Installed simple things bundle into vendor directory via composer file
2) Not sure where to autoload as given in the read me file
3) Added the setting of audited entities in config.yml
simple_things_entity_audit:
audited_entities:
- AcmeDemoBundle\Entity\Vendor
- AcmeDemoBundle\Entity\Employee
But Not sure how to register them as extension in doctrine configuration. I am very new to this bundle. Any help here would be really appreciated.
Use Acme\DemoBundle\Entity\Vendor instead of AcmeDemoBundle\Entity\Vendor

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