AdminBundle and I18n forms - symfony

I was wondering if someone managed to add I18n forms in the SonataAdminBundle to be able to Edit both english fields and other languages fields like we used to do in Symfony 1.4.
Our fields are I18n'ed with the Gedmo Doctrine Extensions
PS: We are using Symfony 2.1-DEV.
Thanks.

personal translations can be used in symfony2 forms I guess including sonata. Using recent stof extensions bundle from master branch. You will need to configure mapping manually, follow the docs on stof bundle.
By default translatable uses a common table for all translations. Which does not have a direct foreign key constraint. You need to specify the #Gedmo\TranslationEntity(class="your\personal\translation\entity\class") class annotation in order to use personal translations.

Related

How to extract translations from a custom vendors bundle

I actually trying to create my own reusable bundle. I created a Demo project that include my custom bundle as dependency using symlink composer config.
Actually, I tried to extract some translation keys from my custom bundle into the demo project.
But when I launch the command bin/console translation:update fr --dump-messages there is no entry from my bundle.
What I want to extract is some constant keys that I want to translate.
For example, in MyCustomClass there is some status in an array. So I don't know if there is an Interface that I can implement to auto extract my translation keys.
I'm using:
Symfony Framework 5.3.8
Symfony Translation 5.3.9
Thanks

FOSElasticaBundle and Gedmo translatable

I want to use FOSElasticaBundle on my symfony2 project.
Both bundles are correctly configured and functionals.
I already use Gedmo Translatable to handle multilingual but I cannot find how to implement gedmo translations in my elastic mapping or to build an elastic query which get results with a chosen locale.
Anyone already experienced this problem ?

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.

Location of propel.ini for symfony2?

I am migrating from symfony1 to symfony2, I have hard time implementing propel behaviors. Where do I actually have the propel.ini in symfony2?
Well in sf1.4, it was inside root config directory. How about symfony2?
The Propel ORM Symfony2 page says this:
You can add a app/config/propel.ini file in your project to specify some configuration parameters. ... However, the recommended way to configure Propel is to rely on build properties.
You can define build properties by creating a propel.ini file in app/config like below, but you can also follow the Symfony2 convention by adding build properties in app/config/config.yml
So I believe you can come close to the Symfony1 behaviour by creating app/config/propel.ini, but the more idiomatic way is to use app/config/config.yml as that page illustrates.
Caveat: I haven't used Propel with Symfony2, so this answer is solely based on the manual.

Sensiolabs/Symfony duplicated components: Which ones should I use?

Pimple or Container?
http://pimple.sensiolabs.org/
http://components.symfony-project.org/dependency-injection/
Twig or Template?
http://twig.sensiolabs.org/
http://components.symfony-project.org/templating/
I'm not asking for an opinion, I just want to know this:
Why are these components being distributed with different names?
Which ones are newer?
Which are the ones being used by symfony 2 ?
Is there a list for components like Pimple and Twig? Like there is for Container and Template: http://components.symfony-project.org/
There are 3 categories of projects you have listed.
Third-party library. While provided by sensiolabs, these are standalone libraries not under the symfony namespace.
Old Symfony 1.x components, also standalone but under the Symfony namespace. Available at components.symfony-project.org, compatible with PHP 5.2.
Symfony2 components, part of the Symfony2 package, but can also be used standalone. Compatible with PHP 5.3+.
Ok, so let's categorize the projects you've listed.
Category 1
Pimple
Twig
There is currently no Pimple bundle for Symfony2. The recommended way to go with is to use the Symfony2 DependencyInjection component, which ships with the framework.
Note: Pimple is heavily used by Silex, so if you like Pimple, you might want to take a look at it. It's a different framework that is based on Symfony2 components.
Twig, on the other hand, is supported very well by the Symfony2 core framework. There is a core Bundle for it, and most of the documentation suggests you use it. It is definitely the recommended way to do templating in Symfony2.
For a list of more of these, take a look at Fabien Potencier's GitHub profile. IMO the important ones are: Twig, Silex, Pimple, Goutte, (Pirum, Sismo).
Category 2
Symfony Components DependencyInjection
Symfony Components Templating
These are old and should no longer be used.
Category 3
Symfony2 DependencyInjection Component
Symfony2 Templating Component
Symfony2 Twig Bundle
These are all part of the Symfony2 framework, and you should use them. They are the latest and greatest.
Hope that answers your questions!
I think that you could use http://components.symfony-project.org components if you have some kind of legacy project that uses php 5.2 or your server has php older than 5.3.
I have a project, I' m doing some rewriting, but it's legacy php 5.2 so I decited to use the old components (http://components.symfony-project.org) instead of new symfony's 2.0 components

Resources