2017 © Pedro Peláez
 

library px-translation-bundle

Enable doctrine entities translations

image

translation/px-translation-bundle

Enable doctrine entities translations

  • Tuesday, February 20, 2018
  • by inesmokni
  • Repository
  • 2 Watchers
  • 1 Stars
  • 65 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

pxtranslationBundle

This bundle is about making an entity translatable and creating forms to store translated data into database. It's based on Gedmo Doctrine2 extensions., (*1)

Features

  • Updates the database to handle translation
  • Persist and get translated values
  • Configure as many supported langages as you want
  • Custom form types to render in forms

Install pxtranslationBundle

1/ Add require to your composer.json and update:, (*2)

"translation/px-translation-bundle" : "dev-master"

2/ Update your AppKernel.php:, (*3)

new translation\pxTranslationBundle\translationpxTranslationBundle()

3/ Update your assets :, (*4)

php bin/console assets:install

4/ Add the translation custom theme uder Twig in your config.yml :, (*5)

twig:
  form_themes:
     - '@translationpxTranslation/Form/translatable_text-prototype.html.twig'

5/ Make sure JQuery is included in your base template:, (*6)

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js" >
 </script>

6/ Update your entities by this command, you need to make sure that you delete the correspondents getter and setters before executing the command line :, (*7)

php bin/console doctrine:translate:entity myBundle:entityName column1,column2
(exple: php bin/console doctrine:translate:entity AppBundle:Book name,description)

7/ Update your database:, (*8)

php bin/console doctrine:schema:update --force 

8/ Update your form type:, (*9)

- text:
  ->add('column', translatableType::class, array("data" => $builder->getData(), "type" => FlagTextType::class))
  (exple: ->add('name', translatableType::class, array("data" => $builder->getData(), "type" => FlagTextType::class)))

- textarea:
   ->add('comumn', translatableType::class, array("data" => $builder->getData(), "type" => FlagTextAreaType::class)) 
   (exple: ->add('description', translatableType::class, array("data" => $builder->getData(), "type" => FlagTextAreaType::class)))

9/ Just submit your form !, (*10)

The Versions

20/02 2018

dev-master

9999999-dev

Enable doctrine entities translations

  Sources   Download

MIT

The Requires

 

by Ines Mokni

translation

19/02 2018

1.1.x-dev

1.1.9999999.9999999-dev

Enable doctrine entities translations

  Sources   Download

MIT

The Requires

 

by Ines Mokni

translation

27/10 2016

1.0.x-dev

1.0.9999999.9999999-dev

Enable doctrine entities translations

  Sources   Download

MIT

The Requires

 

by Ines Mokni

translation