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
Related
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.
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
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.
I became responsible for a large legacy web application and I am trying to slowly refactor it into the Symfony2 framework. The first thing I have done is to include Doctrine.
I have installed Doctrine with the help of Composer and set up a bootstrap file for it. My entities, to avoid future complications, already follow the namespacing scheme Company\BundleName\Entity\Object. The following works:
$em->getRepository('Company\\BundleName\\Entity\\Object')
->find($id)
;
I was unable to find any reference of how to inform Doctrine of namespace aliases as Symfony2 does, so I can write
$em->getRepository('CompanyBundleName:Object')
->find($id)
;
instead. How can I achieve that?
There is an easier way now:
$config = Setup::createAnnotationMetadataConfiguration(...);
$config->addEntityNamespace('CompanyBundleName', 'Company\BundleName\Entity');
will do what you want. It took me several hours hunting to find this! Its not in the docs anywhere I could find.
The functionality for this is set up in Symfony2 by the DoctrineBridge bundle, specifically the getMappingDriverBundleConfigDefaults function.
If you want to reflect this functionality without Symfony2, you'll need to extend the Doctrine entity manager and generate the prefix yourself in the getRepository function. It is not part of the Doctrine system.
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)