Stof doctrine extensions bundle xml mapping for tree and translatable - symfony

Does anyone know how to configure xml mapping for http://gediminasm.org/article/tree-nestedset-behavior-extension-for-doctrine-2? There is the example only with annotations

It is simple as using annotations. In symfony2 in same xml files where you define the mapping add extra mapping information for extensions, all examples are located in the documentation: on github or my blog

Related

How to use variables in Symfony Doctrine ORM annotations?

In short, I would like to use something like:
#ORM\Table(name="schemaname.tablename")
but replacing the "schemaname" string with a variable, that can be set as a configuration parameter somewhere (like in parameters.yml file)
I understand your context as a reusable bundle entity with cross domain relation to an other bundle.
I don't find anything about doctrine mapping customisation, but as your bundle can only be included once per project, I recommand you to use your bundle name as a prefix for the table.
Like yourapp_tablename
For the crossdomain constraint, your bundle, if it is reusable can't have dependencies to external bundles. It is your business bundles which have to use the reusable bundle, not the way around. I guess you have to use interfaces if you want an external bundle to be extending your model class

Gedmo Doctrine Extensions and YML

I am trying to configure translatable extension in my own project. The problem is that I have a whole bundle configured using yaml for mapping entities, so each entity have its own .orm.yml file. Now, I am trying to add the translatable extension but when I run the schema update command I get:
No identifier/primary key specified for Entity "Ruck\SportsBundle\Entity\Tr anslation\SportTranslation" sub class of "Sonata\TranslationBundle\Model\Ge dmo\AbstractPersonalTranslation". Every Entity must have an identifier/prim ary key.
In other bundle where I have used annotations it works fine... So my question is if translatable extension is incompatible with yaml files.
I have reading about this issue
https://github.com/Atlantic18/DoctrineExtensions/issues/671
https://github.com/Atlantic18/DoctrineExtensions/issues/989
but I think is too strange that I can't use yml files with translatable extension...
Thanks

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.

AdminBundle and I18n forms

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.

Resources